Skip to content

Commit

Permalink
AP-5473: Replace display_emergency_certificate? calls
Browse files Browse the repository at this point in the history
There was a duplicate method in the delegated_functions concern that
is being used in multiple other places.  Therefore the removal and
replacement of these calls to the other method made the most sense
colinbruce committed Nov 11, 2024
1 parent 7473e4b commit 3353f29
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
@@ -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
2 changes: 1 addition & 1 deletion app/views/providers/limitations/_proceeding_type.html.erb
Original file line number Diff line number Diff line change
@@ -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 %>
2 changes: 1 addition & 1 deletion app/views/providers/limitations/show.html.erb
Original file line number Diff line number Diff line change
@@ -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">
22 changes: 0 additions & 22 deletions spec/models/legal_aid_application_spec.rb
Original file line number Diff line number Diff line change
@@ -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 }

0 comments on commit 3353f29

Please sign in to comment.