noosfero | WIP: Custom forms graphs (!1597)
Matheus Richard
gitlab at mg.gitlab.com
Fri Aug 17 11:54:39 BRT 2018
Matheus Richard started a new discussion on plugins/custom_forms/db/migrate/20180815152844_add_form_answers_on_old_answers.rb:
> +class AddFormAnswersOnOldAnswers < ActiveRecord::Migration
> + def up
> + answers_without_form_answer = CustomFormsPlugin::Answer.includes(:form_answers)
> + .where(custom_forms_plugin_form_answers: {id: nil})
> + select_answers_without_form_answer = answers_without_form_answer.select {|a| a.field.type == "CustomFormsPlugin::SelectField"}
> +
> + select_answers_without_form_answer.each do |answer|
> + alternatives_ids = answer.attributes['value']
> + alternatives = CustomFormsPlugin::Alternative.where("id IN (?)", alternatives_ids)
Maybe we can preload the alternatives right on the query.
--
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1597#note_95161262
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/20180817/43349394/attachment.html>
More information about the Noosfero-dev
mailing list