Browse Source

Filter out location questions before checking the routing (#2557)

pull/2545/head^2
kosiakkatrina 5 months ago committed by GitHub
parent
commit
979e2a6ba2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      app/models/lettings_log.rb

12
app/models/lettings_log.rb

@ -581,14 +581,22 @@ class LettingsLog < Log
def non_location_setup_questions_completed?
form.setup_sections.all? do |section|
section.subsections.all? do |subsection|
relevant_qs = subsection.applicable_questions(self).reject { |q| optional_fields.include?(q.id) || %w[scheme_id location_id].include?(q.id) }
relevant_qs.all? do |question|
relevant_qs = subsection.questions.reject { |q| optional_fields.include?(q.id) || %w[scheme_id location_id].include?(q.id) }
relevant_applicable_qs = select_applicable_questions(self, relevant_qs)
relevant_applicable_qs.all? do |question|
question.completed?(self)
end
end
end
end
# this is the same as the subsection method, but only for given questions
def select_applicable_questions(log, questions)
questions.select do |q|
(q.displayed_to_user?(log) && !q.derived?(log)) || q.is_derived_or_has_inferred_check_answers_value?(log)
end
end
def resolve!
update(unresolved: false)
end

Loading…
Cancel
Save