Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP-5273: SCA level of service fix #7120

Merged
merged 4 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/forms/proceedings/substantive_defaults_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def save
attributes[:substantive_level_of_service_name] = nil
attributes[:substantive_level_of_service_stage] = nil
else
model.update!(substantive_level_of_service:,
substantive_level_of_service_name:,
substantive_level_of_service_stage:)
model.scope_limitations.create!(scope_type: :substantive,
code: substantive_scope_limitation_code,
meaning: substantive_scope_limitation_meaning,
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/check_answers/_proceeding_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
) %>

<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.name}_emergency_scope_limitations_#{proceeding.id}" }) do |row| %>
<%= row.with_key(text: t(".level_of_service.emergency.question"), classes: "govuk-!-width-one-half") %>
<%= row.with_key(text: t(".scope_limits.emergency.question"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { scope_limits(proceeding, "emergency") } %>
<% end %>
<% end %>
Expand All @@ -59,7 +59,7 @@
) %>

<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.name}_substantive_scope_limitations_#{proceeding.id}" }) do |row| %>
<%= row.with_key(text: t(".level_of_service.substantive.question"), classes: "govuk-!-width-one-half") %>
<%= row.with_key(text: t(".scope_limits.substantive.question"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { scope_limits(proceeding, "substantive") } %>
<% end %>
<% end %>
5 changes: 5 additions & 0 deletions config/locales/en/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,11 @@ en:
question: Emergency level of service
substantive:
question: Substantive level of service
scope_limits:
emergency:
question: Emergency scope limitations
substantive:
question: Substantive scope limitations
delegated_functions:
not_used: Not used
section_delegated:
Expand Down
6 changes: 6 additions & 0 deletions spec/factories/proceedings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
used_delegated_functions_reported_on { Time.zone.today }
end

trait :no_substantive_level_of_service do
substantive_level_of_service { nil }
substantive_level_of_service_name { nil }
substantive_level_of_service_stage { nil }
end

transient do
no_scope_limitations { false }
end
Expand Down
5 changes: 4 additions & 1 deletion spec/forms/proceedings/substantive_defaults_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

context "with a Special Childrens Act proceeding" do
let(:params) { {} }
let(:proceeding) { create(:proceeding, :pb003, :without_df_date, client_involvement_type_ccms_code: "A", no_scope_limitations: true) }
let(:proceeding) { create(:proceeding, :pb003, :without_df_date, :no_substantive_level_of_service, client_involvement_type_ccms_code: "A", no_scope_limitations: true) }

it "sets the default values" do
expect(proceeding.substantive_level_of_service).to eq 3
Expand All @@ -122,6 +122,9 @@
let(:skip_subject) { true }

it "creates a scope_limitation object" do
expect(proceeding.substantive_level_of_service).to be_nil
expect(proceeding.substantive_level_of_service_name).to be_nil
expect(proceeding.substantive_level_of_service_stage).to be_nil
expect { save_form }.to change(proceeding.scope_limitations, :count).by(1)
expect(proceeding.scope_limitations.find_by(scope_type: :substantive)).to have_attributes(code: "FM062", description: "Limited to all steps up to and including final hearing and any action necessary to implement (but not enforce) the order.")
end
Expand Down