From 0e9bf8c1d7811dd14e5f65d6c70b4ebcf2ce3227 Mon Sep 17 00:00:00 2001 From: Kat Date: Thu, 10 Nov 2022 12:55:13 +0000 Subject: [PATCH] Update affected logs label --- app/models/location.rb | 1 + app/views/locations/toggle_active_confirm.html.erb | 2 +- spec/requests/locations_controller_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/location.rb b/app/models/location.rb index 0fdc24a8e..874d26245 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -2,6 +2,7 @@ class Location < ApplicationRecord validate :validate_postcode validates :units, :type_of_unit, :mobility_type, presence: true belongs_to :scheme + has_many :lettings_logs, class_name: "LettingsLog" has_paper_trail diff --git a/app/views/locations/toggle_active_confirm.html.erb b/app/views/locations/toggle_active_confirm.html.erb index 8bf8722a2..474e36454 100644 --- a/app/views/locations/toggle_active_confirm.html.erb +++ b/app/views/locations/toggle_active_confirm.html.erb @@ -4,7 +4,7 @@ <% end %>

<%= @scheme.service_name %> - <%= "This change will affect SOME logs" %> + <%= "This change will affect #{@location.lettings_logs.count} logs" %>

<%= govuk_warning_text text: I18n.t("warnings.location.deactivation.review_logs") %> <%= f.hidden_field :confirm, :value => true %> diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index e74ffb691..80213a73f 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -1253,7 +1253,7 @@ RSpec.describe LocationsController, type: :request do it "renders the confirmation page" do expect(response).to have_http_status(:ok) - expect(page).to have_content("This change will affect SOME logs") + expect(page).to have_content("This change will affect #{location.lettings_logs.count} logs") end end @@ -1262,7 +1262,7 @@ RSpec.describe LocationsController, type: :request do it "renders the confirmation page" do expect(response).to have_http_status(:ok) - expect(page).to have_content("This change will affect SOME logs") + expect(page).to have_content("This change will affect #{location.lettings_logs.count} logs") end end