From 364b19c1849dc282d7bd0b9e5822d5ff4f6fad86 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:27:24 +0000 Subject: [PATCH] Also log earnings and incfrew (#2248) --- lib/tasks/clear_invalidated_earnings.rake | 2 +- spec/lib/tasks/clear_invalidated_earnings_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/clear_invalidated_earnings.rake b/lib/tasks/clear_invalidated_earnings.rake index b474a675a..1229c4be9 100644 --- a/lib/tasks/clear_invalidated_earnings.rake +++ b/lib/tasks/clear_invalidated_earnings.rake @@ -3,7 +3,7 @@ task clear_invalidated_earnings: :environment do LettingsLog.filter_by_year(2023).find_each do |lettings_log| lettings_log.validate_net_income(lettings_log) if lettings_log.errors[:earnings].present? - Rails.logger.info "Clearing earnings for lettings log #{lettings_log.id}, owning_organisation_id: #{lettings_log.owning_organisation_id}, managing_organisation_id: #{lettings_log.managing_organisation_id}, startdate: #{lettings_log.startdate.to_date}, tenancy reference: #{lettings_log.tenancycode}, property reference: #{lettings_log.propcode}, created_by: #{lettings_log.created_by.email}(#{lettings_log.created_by_id})" + Rails.logger.info "Clearing earnings for lettings log #{lettings_log.id}, owning_organisation_id: #{lettings_log.owning_organisation_id}, managing_organisation_id: #{lettings_log.managing_organisation_id}, startdate: #{lettings_log.startdate.to_date}, tenancy reference: #{lettings_log.tenancycode}, property reference: #{lettings_log.propcode}, created_by: #{lettings_log.created_by.email}(#{lettings_log.created_by_id}), earnings: #{lettings_log.earnings}, incfreq: #{lettings_log.incfreq}" lettings_log.earnings = nil lettings_log.incfreq = nil lettings_log.save!(validate: false) diff --git a/spec/lib/tasks/clear_invalidated_earnings_spec.rb b/spec/lib/tasks/clear_invalidated_earnings_spec.rb index b7cd617ff..796b43e8a 100644 --- a/spec/lib/tasks/clear_invalidated_earnings_spec.rb +++ b/spec/lib/tasks/clear_invalidated_earnings_spec.rb @@ -32,7 +32,7 @@ RSpec.describe "clear_invalidated_earnings" do expect(lettings_log.earnings).to eq(20) expect(lettings_log.hhmemb).to eq(1) expect(lettings_log.ecstat1).to eq(1) - expect(Rails.logger).to receive(:info).with("Clearing earnings for lettings log #{lettings_log.id}, owning_organisation_id: #{lettings_log.owning_organisation_id}, managing_organisation_id: #{lettings_log.managing_organisation_id}, startdate: 2023-04-04, tenancy reference: 123, property reference: 321, created_by: #{user.email}(#{user.id})") + expect(Rails.logger).to receive(:info).with("Clearing earnings for lettings log #{lettings_log.id}, owning_organisation_id: #{lettings_log.owning_organisation_id}, managing_organisation_id: #{lettings_log.managing_organisation_id}, startdate: 2023-04-04, tenancy reference: 123, property reference: 321, created_by: #{user.email}(#{user.id}), earnings: 20, incfreq: 1") task.invoke lettings_log.reload