18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/forms/decidim/votings/closure_result_form.rb', line 18
def map_model(model)
self.id = model.id
self.polling_station_id = model.polling_station.id
self.election_id = model.election.id
self.ballot_results = BallotResultForm.from_model(model)
self.question_results = model.election.questions.flat_map do |question|
QuestionResultForm.from_model(question:, closure: model)
end
self.answer_results = model.election.questions.flat_map do |question|
question.answers.map do |answer|
AnswerResultForm.from_model(answer:, closure: model)
end
end
end
|