Files
nairobi/app/helpers/officing_helper.rb
Javi Martín b23ea25367 Apply Performance/CompareWithBlock rule to sort!
We should have applied this change in commit a78a8d592, since it was
added in rubocop-performance 1.18.0, but forgot to do so.
2023-09-06 14:54:21 +02:00

19 lines
555 B
Ruby

module OfficingHelper
def booths_for_officer_select_options(officer_assignments)
options = []
officer_assignments.each do |oa|
options << [oa.booth_assignment.booth.name.to_s, oa.id]
end
options.sort_by! { |x| x[0] }
options_for_select(options, params[:oa])
end
def answer_result_value(question_id, answer_index)
return nil if params.blank?
return nil if params[:questions].blank?
return nil if params[:questions][question_id.to_s].blank?
params[:questions][question_id.to_s][answer_index.to_s]
end
end