Skip to content

Commit

Permalink
Merge pull request #7414 from ministryofjustice/ap-5473/rationalise-s…
Browse files Browse the repository at this point in the history
…ca-code

AP-5473: Replace display_emergency_certificate? calls
  • Loading branch information
colinbruce authored Nov 11, 2024
2 parents 4f0fec6 + 3353f29 commit 3d00788
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 29 deletions.
6 changes: 1 addition & 5 deletions app/models/legal_aid_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,12 @@ def default_cost_limitation
default_substantive_cost_limitation
end

def display_emergency_certificate?
used_delegated_functions? && !special_children_act_proceedings?
end

def substantive_cost_overridable?
substantive_cost_limitation.present? && default_substantive_cost_limitation < MAX_SUBSTANTIVE_COST_LIMIT && !special_children_act_proceedings? && !family_linked_associated_application?
end

def emergency_cost_overridable?
display_emergency_certificate? && !family_linked_associated_application?
non_sca_used_delegated_functions? && !family_linked_associated_application?
end

def substantive_cost_limitation
Expand Down
2 changes: 1 addition & 1 deletion app/views/providers/limitations/_proceeding_type.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</span>
</h3>
<%= govuk_details(summary_text: t(".details_heading")) do %>
<% if @legal_aid_application.display_emergency_certificate? %>
<% if @legal_aid_application.non_sca_used_delegated_functions? %>
<h4 class="govuk-heading-m"><%= t(".emergency_certificate") %></h4>
<p><strong><%= t(".form_of_service") %></strong>
<%= proceeding.emergency_level_of_service_name %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/providers/limitations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
locals: { translation_path: "providers.limitations.show" } %>

<h2 class="govuk-heading-l"><%= t(".cost_heading") %></h2>
<% if @legal_aid_application.display_emergency_certificate? %>
<% if @legal_aid_application.non_sca_used_delegated_functions? %>
<h3 class="govuk-heading-m"><%= t(".emergency_certificate") %></h3>

<p class="govuk-body">
Expand Down
22 changes: 0 additions & 22 deletions spec/models/legal_aid_application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2174,28 +2174,6 @@
end
end

describe "#display_emergency_certificate?" do
subject { legal_aid_application.display_emergency_certificate? }

let(:legal_aid_application) { create(:legal_aid_application, :with_proceedings, :with_delegated_functions_on_proceedings, explicit_proceedings: %i[da001], df_options: { DA001: [Time.zone.today, Time.zone.today] }) }

context "when the provider has used delegated functions" do
it { is_expected.to be true }
end

context "when the provider has not used delegated functions" do
let(:legal_aid_application) { create(:legal_aid_application) }

it { is_expected.to be false }
end

context "when there are special childrens act proceedings" do
before { legal_aid_application.proceedings << create(:proceeding, :pb003) }

it { is_expected.to be false }
end
end

describe "#related_proceedings" do
subject { legal_aid_application.related_proceedings }

Expand Down

0 comments on commit 3d00788

Please sign in to comment.