lib/decidim/elections/component.rb in decidim-elections-0.25.2 vs lib/decidim/elections/component.rb in decidim-elections-0.26.0.rc1
- old
+ new
@@ -54,10 +54,11 @@
exports.serializer Decidim::Forms::UserAnswersSerializer
end
component.exports :elections do |exports|
exports.collection do |component_instance|
- Decidim::Elections::Question.where(election: Decidim::Elections::Election.where(component: component_instance).bb_results_published).collect(&:answers).flatten
+ Decidim::Elections::Answer
+ .where(decidim_elections_question_id: Decidim::Elections::Election.where(component: component_instance).bb_results_published.extract_associated(:questions))
end
exports.include_in_open_data = true
exports.serializer Decidim::Elections::AnswerSerializer