diff --git a/app/models/location.rb b/app/models/location.rb index 93bc2ff7d..bcc424d21 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -113,8 +113,6 @@ class Location < ApplicationRecord .where.not(id: joins(scheme: [:scheme_deactivation_periods]).merge(Location.deactivated_by_scheme(date)).pluck(:id)) .where.not(id: joins(scheme: [:owning_organisation]).merge(Location.deactivated_by_organisation).pluck(:id)) .where.not(id: incomplete.pluck(:id)) - .where.not(id: joins(:location_deactivation_periods).merge(Location.deactivating_soon_directly(date)).pluck(:id)) - .where.not(id: joins(scheme: %i[owning_organisation scheme_deactivation_periods]).merge(Location.deactivating_soon_by_scheme(date)).pluck(:id)) .where.not(id: activating_soon(date).pluck(:id)) } diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index 9759aa390..1c6b32cf8 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -612,9 +612,9 @@ RSpec.describe SchemesController, type: :request do context "with scheme that's deactivating soon" do let(:scheme_deactivation_period) { create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 10, 12), scheme:) } - it "does not render toggle scheme link" do + it "does render the reactivate this scheme button" do expect(response).to have_http_status(:ok) - expect(page).not_to have_link("Reactivate this scheme") + expect(page).to have_link("Reactivate this scheme") expect(page).not_to have_link("Deactivate this scheme") end end @@ -680,9 +680,9 @@ RSpec.describe SchemesController, type: :request do context "with scheme that's deactivating soon" do let(:scheme_deactivation_period) { create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 10, 12), scheme: specific_scheme) } - it "does not render toggle scheme link" do + it "does render the reactivate this scheme button" do expect(response).to have_http_status(:ok) - expect(page).not_to have_link("Reactivate this scheme") + expect(page).to have_link("Reactivate this scheme") expect(page).not_to have_link("Deactivate this scheme") end end @@ -748,7 +748,7 @@ RSpec.describe SchemesController, type: :request do let(:add_deactivations) { scheme.scheme_deactivation_periods << scheme_deactivation_period } before do - create(:location, scheme:, startdate: Time.utc(2022, 9, 9)) + create(:location, scheme:) Timecop.freeze(Time.utc(2022, 10, 10)) sign_in user add_deactivations @@ -784,7 +784,7 @@ RSpec.describe SchemesController, type: :request do context "and associated logs in editable collection period" do before do - create(:location, scheme:, startdate: Time.zone.local(2022, 9, 9)) + create(:location, scheme:) create(:lettings_log, :sh, scheme:, startdate: Time.zone.local(2022, 9, 9), owning_organisation: user.organisation) get "/schemes/#{scheme.id}" end