From a35cbfd063ae053caeb3c44b4816ecbd869215fc Mon Sep 17 00:00:00 2001 From: Kat Date: Fri, 25 Aug 2023 12:30:30 +0100 Subject: [PATCH] Make has_other_client_group a mandatory question --- app/models/scheme.rb | 2 +- app/views/schemes/confirm_secondary.html.erb | 2 ++ spec/factories/scheme.rb | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 08d7dedd5..6afe8cd81 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -238,7 +238,7 @@ class Scheme < ApplicationRecord end def validate_confirmed - required_attributes = attribute_names - %w[id created_at updated_at old_id old_visible_id confirmed end_date sensitive secondary_client_group total_units has_other_client_group deactivation_date deactivation_date_type] + required_attributes = attribute_names - %w[id created_at updated_at old_id old_visible_id confirmed end_date sensitive secondary_client_group total_units deactivation_date deactivation_date_type] if confirmed == true required_attributes.any? do |attribute| diff --git a/app/views/schemes/confirm_secondary.html.erb b/app/views/schemes/confirm_secondary.html.erb index e267b3289..c0cc50220 100644 --- a/app/views/schemes/confirm_secondary.html.erb +++ b/app/views/schemes/confirm_secondary.html.erb @@ -11,6 +11,8 @@ <%= form_for(@scheme, method: :patch) do |f| %>
+ <%= f.govuk_error_summary %> + <% selection = [OpenStruct.new(id: "Yes", name: "Yes"), OpenStruct.new(id: "No", name: "No")] %> <%= f.govuk_collection_radio_buttons :has_other_client_group, selection, diff --git a/spec/factories/scheme.rb b/spec/factories/scheme.rb index 5441df32e..3877e3c99 100644 --- a/spec/factories/scheme.rb +++ b/spec/factories/scheme.rb @@ -9,6 +9,7 @@ FactoryBot.define do intended_stay { %w[M P S V X].sample } primary_client_group { %w[O H M L A G F B D E I S N R Q P X].sample } secondary_client_group { %w[O H M L A G F B D E I S N R Q P X].sample } + has_other_client_group { 1 } owning_organisation { FactoryBot.create(:organisation) } confirmed { true } created_at { Time.zone.local(2021, 4, 1) } @@ -20,6 +21,7 @@ FactoryBot.define do intended_stay { "M" } primary_client_group { "G" } secondary_client_group { "M" } + has_other_client_group { 1 } end trait :with_old_visible_id do