noosfero | WIP: Custom forms graphs (!1597)
Matheus Richard
gitlab at mg.gitlab.com
Fri Aug 10 11:36:31 BRT 2018
Matheus Richard started a new discussion on plugins/custom_forms/lib/custom_forms_plugin/graph.rb:
> + custom_forms_plugin_fields.show_as AS show_as,
> + custom_forms_plugin_alternatives.id AS alternative,
> + custom_forms_plugin_alternatives.label AS label,
> + COUNT(custom_forms_plugin_form_answers.alternative_id) AS answer_count')
> 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,
@diguliu I had to do this in order to group by Field. Is there a better way to do it?
--
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1597#note_93795560
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/eff9e201/attachment-0001.html>
More information about the Noosfero-dev
mailing list