From 32c5005ae1534ceebeea9df3e8b1a3bf3aeed3cf Mon Sep 17 00:00:00 2001 From: Benjamin Eskola Date: Tue, 25 Feb 2025 16:41:08 +0000 Subject: [PATCH] Be more specific in application type `consultation?` and `consultation_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. --- app/models/application_type.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/application_type.rb b/app/models/application_type.rb index 22e73ca48..6b8a93901 100644 --- a/app/models/application_type.rb +++ b/app/models/application_type.rb @@ -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? @@ -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|