diff --git a/Dockerfile b/Dockerfile index 1c478d897..b26aad246 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apk add --update --no-cache tzdata && \ # build-base: compilation tools for bundle # yarn: node package manager # postgresql-dev: postgres driver and libraries -RUN apk add --no-cache build-base=0.5-r3 busybox=1.36.1-r6 nodejs-current=20.8.1-r0 yarn=1.22.19-r0 postgresql13-dev=13.15-r0 git=2.40.1-r0 bash=5.2.15-r5 +RUN apk add --no-cache build-base=0.5-r3 busybox=1.36.1-r7 nodejs-current=20.8.1-r0 yarn=1.22.19-r0 postgresql13-dev=13.15-r0 git=2.40.1-r0 bash=5.2.15-r5 # Bundler version should be the same version as what the Gemfile.lock was bundled with RUN gem install bundler:2.3.14 --no-document diff --git a/app/components/lettings_log_summary_component.html.erb b/app/components/lettings_log_summary_component.html.erb index 92636b148..89fddad20 100644 --- a/app/components/lettings_log_summary_component.html.erb +++ b/app/components/lettings_log_summary_component.html.erb @@ -28,7 +28,7 @@ <% end %>
<% end %> - <% if current_user.support? || current_user.organisation.has_managing_agents? || current_user.organisation.has_recent_absorbed_organisations? %> + <% if current_user.support? || current_user.organisation.has_managing_agents? || current_user.organisation.has_organisations_absorbed_during_displayed_collection_period? %>Merge date: <%= merge_date&.to_formatted_s(:govuk_date) %>
<%= govuk_table do |table| %> <%= table.with_head do |head| %> diff --git a/lib/tasks/fix_nil_letting_allocation_values.rake b/lib/tasks/fix_nil_letting_allocation_values.rake index 770fc63d7..1136ed684 100644 --- a/lib/tasks/fix_nil_letting_allocation_values.rake +++ b/lib/tasks/fix_nil_letting_allocation_values.rake @@ -20,6 +20,6 @@ task fix_nil_letting_allocation_values: :environment do next if log.save - Rails.logger.log("NilLettingsAllocationValues: Unable to save changes to log #{log.id}") + Rails.logger.info("NilLettingsAllocationValues: Unable to save changes to log #{log.id}") end end diff --git a/spec/lib/tasks/fix_nil_letting_allocation_values_spec.rb b/spec/lib/tasks/fix_nil_letting_allocation_values_spec.rb index c8992a6e6..8db478eb8 100644 --- a/spec/lib/tasks/fix_nil_letting_allocation_values_spec.rb +++ b/spec/lib/tasks/fix_nil_letting_allocation_values_spec.rb @@ -66,7 +66,7 @@ RSpec.describe "fix_nil_letting_allocation_values" do it "logs the log id if the change cannot be saved" do log = create(:lettings_log, :ignore_validation_errors, :setup_completed, startdate: Time.zone.local(2022, 4, 1), cbl: 1, chr: nil, cap: nil, letting_allocation_unknown: nil) - expect(Rails.logger).to receive(:log).with(match(/log #{log.id}/)) + expect(Rails.logger).to receive(:info).with(match(/log #{log.id}/)) task.invoke end end diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 1b236f8fc..f30a1e4eb 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -381,14 +381,11 @@ RSpec.describe OrganisationsController, type: :request do end context "when the organisation has absorbed other organisations" do - let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation") } - let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation") } - let!(:previously_absorbed_organisation) { create(:organisation, name: "Previously Absorbed Organisation") } + let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) } + let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) } + let!(:previously_absorbed_organisation) { create(:organisation, name: "Previously Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 2), absorbing_organisation: organisation) } before do - absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) - other_absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) - previously_absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 2), absorbing_organisation: organisation) get "/organisations/#{organisation.id}/details", headers:, params: {} end @@ -406,12 +403,23 @@ RSpec.describe OrganisationsController, type: :request do end context "when the organisation has absorbed other organisations during a closed collection period" do - let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation") } - let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation") } + before do + create(:organisation, name: "First Absorbed Organisation", with_dsa: false, merge_date: Time.zone.today - 2.years, absorbing_organisation: organisation) + create(:organisation, name: "Other Absorbed Organisation", with_dsa: false, merge_date: Time.zone.today - 2.years, absorbing_organisation: organisation) + get "/organisations/#{organisation.id}/details", headers:, params: {} + end + + it "displays absorbed organisations" do + expect(page).to have_content("View all organisations that were merged into #{organisation.name}") + expect(page).to have_content("First Absorbed Organisation") + expect(page).to have_content("Other Absorbed Organisation") + end + end + context "when the organisation has absorbed other organisations during a collection period before archived" do before do - absorbed_organisation.update!(merge_date: Time.zone.local(2021, 4, 3), absorbing_organisation: organisation) - other_absorbed_organisation.update!(merge_date: Time.zone.local(2021, 4, 3), absorbing_organisation: organisation) + create(:organisation, name: "First Absorbed Organisation", with_dsa: false, merge_date: Time.zone.today - 3.years, absorbing_organisation: organisation) + create(:organisation, name: "Other Absorbed Organisation", with_dsa: false, merge_date: Time.zone.today - 3.years, absorbing_organisation: organisation) get "/organisations/#{organisation.id}/details", headers:, params: {} end @@ -424,12 +432,10 @@ RSpec.describe OrganisationsController, type: :request do end context "when the organisation has absorbed other organisations without merge dates" do - let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation") } - let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation") } + let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) } + let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) } before do - absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) - other_absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) get "/organisations/#{organisation.id}/details", headers:, params: {} end