You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
469 B
13 lines
469 B
2 weeks ago
|
desc "Bulk update logs with invalid rp_dontknow values"
|
||
|
task recalculate_invalid_rpdontknow: :environment do
|
||
|
validation_trigger_condition = "rp_dontknow = 1 AND (rp_homeless = 1 OR rp_insan_unsat = 1 OR rp_medwel = 1 OR rp_hardship = 1)"
|
||
|
|
||
|
LettingsLog.filter_by_year(2024).where(validation_trigger_condition).find_each do |log|
|
||
|
log.rp_dontknow = 0
|
||
|
|
||
|
unless log.save
|
||
|
Rails.logger.info "Could not save changes to lettings log #{log.id}"
|
||
|
end
|
||
|
end
|
||
|
end
|