Browse Source

Hides the location again correctly

pull/748/head
Stéphane Meny 3 years ago
parent
commit
a3a70751f0
No known key found for this signature in database
GPG Key ID: 9D0AFEA988527923
  1. 6
      app/models/form.rb
  2. 1
      app/models/form/setup/questions/location_id.rb
  3. 2
      spec/models/form/setup/questions/location_id_spec.rb

6
app/models/form.rb

@ -127,9 +127,9 @@ class Form
end end
def invalidated_page_questions(case_log, current_user = nil) def invalidated_page_questions(case_log, current_user = nil)
# we're already treating address fields as a special case and reset their values upon saving a case_log # we're already treating these fields as a special case and reset their values upon saving a case_log
address_questions = %w[postcode_known la ppcodenk previous_la_known prevloc postcode_full ppostcode_full] callback_questions = %w[postcode_known la ppcodenk previous_la_known prevloc postcode_full ppostcode_full location_id]
questions.reject { |q| q.page.routed_to?(case_log, current_user) || q.derived? || address_questions.include?(q.id) } || [] questions.reject { |q| q.page.routed_to?(case_log, current_user) || q.derived? || callback_questions.include?(q.id) } || []
end end
def enabled_page_questions(case_log) def enabled_page_questions(case_log)

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

@ -5,7 +5,6 @@ class Form::Setup::Questions::LocationId < ::Form::Question
@header = "Which location is this log for?" @header = "Which location is this log for?"
@hint_text = "" @hint_text = ""
@type = "radio" @type = "radio"
@derived = true
@answer_options = answer_options @answer_options = answer_options
end end

2
spec/models/form/setup/questions/location_id_spec.rb

@ -28,7 +28,7 @@ RSpec.describe Form::Setup::Questions::LocationId, type: :model do
end end
it "is marked as derived" do it "is marked as derived" do
expect(question).to be_derived expect(question).not_to be_derived
end end
context "when there are no locations" do context "when there are no locations" do

Loading…
Cancel
Save