Browse Source

Make has_other_client_group a mandatory question

pull/1871/head
Kat 3 years ago
parent
commit
a35cbfd063
  1. 2
      app/models/scheme.rb
  2. 2
      app/views/schemes/confirm_secondary.html.erb
  3. 2
      spec/factories/scheme.rb

2
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|

2
app/views/schemes/confirm_secondary.html.erb

@ -11,6 +11,8 @@
<%= form_for(@scheme, method: :patch) do |f| %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= 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,

2
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

Loading…
Cancel
Save