Browse Source

Fix logger (#2457)

pull/2465/head
kosiakkatrina 7 months ago committed by GitHub
parent
commit
c6d5ade30b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      lib/tasks/recalculate_vacdays.rake

4
lib/tasks/recalculate_vacdays.rake

@ -1,14 +1,14 @@
desc "Recalculate vacdays after bugfix for daylight savings time changes"
task recalculate_vacdays: :environment do
LettingsLog.where.not(vacdays: nil).find_each do |log|
Rails.logger.log("Log #{log.id}")
Rails.logger.info("Log #{log.id}")
recalculated_vacdays = log.send(:property_vacant_days)
next if recalculated_vacdays == log.vacdays
log.vacdays = recalculated_vacdays
next if log.save
Rails.logger.log("Log #{log.id} could not be saved, saving updated vacdays without validation")
Rails.logger.info("Log #{log.id} could not be saved, saving updated vacdays without validation")
log.reload
log.vacdays = recalculated_vacdays
log.save!(validate: false)

Loading…
Cancel
Save