Skip to content

Commit

Permalink
Be more specific in application type consultation? and `consultatio…
Browse files Browse the repository at this point in the history
…n_steps`

If the steps contain 'consultation' but there are no consultation steps
defined, this method will return false. This means that a consultation
record will not be created for an application of this type. However,
when iterating over the steps, it will include 'consultation' and thus
try to render those tasks, which will fail.

So, these should behave consistently, it should not be possible to have
application types with consultations but no consultation steps or vice
versa.
  • Loading branch information
benjamineskola committed Feb 25, 2025
1 parent 40c9560 commit 32c5005
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/models/application_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class ApplicationType < ApplicationRecord
delegate :assess_against_policies?
delegate :cil?
delegate :considerations?
delegate :consultation_steps
delegate :consultations_skip_bank_holidays?
delegate :description_change_requires_validation?
delegate :eia?
Expand Down Expand Up @@ -268,7 +267,13 @@ def human_name
end

def consultation?
consultation_steps.any?
steps.include?("consultation")
end

def consultation_steps
return [] unless consultation?

features.consultation_steps
end

Consultation::STEPS.each do |feature|
Expand Down

0 comments on commit 32c5005

Please sign in to comment.