Browse Source

Less loops (#711)

cldc-1228-organisation-fixes-juris
baarkerlounger 3 years ago committed by GitHub
parent
commit
7798178cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/models/form/setup/questions/location_id.rb

4
app/models/form/setup/questions/location_id.rb

@ -22,8 +22,8 @@ class Form::Setup::Questions::LocationId < ::Form::Question
def displayed_answer_options(case_log)
return {} unless case_log.scheme
scheme_location_ids = Location.where(scheme_id: case_log.scheme.id).map(&:id).map(&:to_s)
answer_options.select { |k, _v| scheme_location_ids.include?(k) }
scheme_location_ids = case_log.scheme.locations.pluck(:id)
answer_options.select { |k, _v| scheme_location_ids.include?(k.to_i) }
end
def hidden_in_check_answers?(case_log, _current_user = nil)

Loading…
Cancel
Save