Browse Source
* CLDC-4298: Update purchase price step for 2026 * CLDC-4298: Add a rake task to round value values * fixup! CLDC-4298: Add a rake task to round value values remove redundant query update desc remove unneeded commentpull/3309/head
2 changed files with 12 additions and 1 deletions
@ -0,0 +1,11 @@ |
|||||||
|
desc "Rounds purchase price (the 'value' field) for sales logs in the database if not a whole number" |
||||||
|
task round_value_for_2026_sales_logs: :environment do |
||||||
|
logs = SalesLog.filter_by_year(2026).where("value % 1 != 0") |
||||||
|
puts "Correcting #{logs.count} sales logs, #{logs.map(&:id)}" |
||||||
|
|
||||||
|
logs.find_each do |log| |
||||||
|
log.update(value: log.value.round) |
||||||
|
end |
||||||
|
|
||||||
|
puts "Done" |
||||||
|
end |
||||||
Loading…
Reference in new issue