noosfero | WIP: Custom forms graphs (!1597)

Matheus Richard gitlab at mg.gitlab.com
Fri Aug 10 11:38:04 BRT 2018


Matheus Richard started a new discussion on plugins/custom_forms/lib/custom_forms_plugin/graph.rb:

>    end
>  
> -  alias select_answers radio_answers
> -  alias multiple_select_answers check_box_answers
> +  def get_text_fields
> +    @form.fields
> +         .joins("INNER JOIN custom_forms_plugin_answers as ans ON ans.field_id = custom_forms_plugin_fields.id
> +                 INNER JOIN custom_forms_plugin_submissions as s ON s.id = ans.submission_id")
> +         .group("custom_forms_plugin_fields.id, custom_forms_plugin_fields.name")
> +         .select("custom_forms_plugin_fields.id as id,
> +                   custom_forms_plugin_fields.name as field_name,
> +                   STRING_AGG(ans.value, ',') as answers,
> +                   STRING_AGG(s.author_name, ',') as users,
> +                   custom_forms_plugin_fields.show_as as show_as,
> +                   STRING_AGG(ans.imported::text, ',') as imported")
> +         .where("custom_forms_plugin_fields.type = 'CustomFormsPlugin::TextField'")

@diguliu I'm not sure if there's a better way to do this too.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1597#note_93795958
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180810/6536c08f/attachment.html>


More information about the Noosfero-dev mailing list