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.
25 lines
917 B
25 lines
917 B
1 week ago
|
namespace :bulk_update do
|
||
|
desc "Update logs with specific criteria and set manual_address_entry_selected to true"
|
||
|
task update_manual_address_entry_selected: :environment do
|
||
|
lettings_logs = LettingsLog.filter_by_year(2024)
|
||
|
.where(status: %w[in_progress completed])
|
||
|
.where(needstype: 1, manual_address_entry_selected: false, uprn: nil)
|
||
|
|
||
|
lettings_logs.find_each do |log|
|
||
|
log.update(manual_address_entry_selected: true)
|
||
|
end
|
||
|
|
||
|
puts "#{lettings_logs.count} lettings logs updated."
|
||
|
|
||
|
sales_logs = SalesLog.filter_by_year(2024)
|
||
|
.where(status: %w[in_progress completed])
|
||
|
.where(manual_address_entry_selected: false, uprn: nil)
|
||
|
|
||
|
sales_logs.find_each do |log|
|
||
|
log.update(manual_address_entry_selected: true)
|
||
|
end
|
||
|
|
||
|
puts "#{sales_logs.count} sales logs updated."
|
||
|
end
|
||
|
end
|