Browse Source

Merge ef941ac35a into 15f6e2a919

pull/3297/merge
Samuel Young 2 days ago committed by GitHub
parent
commit
e2162ed690
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      app/models/form/sales/questions/purchase_price.rb
  2. 12
      lib/tasks/round_value_for_2026_sales_logs.rake

2
app/models/form/sales/questions/purchase_price.rb

@ -4,7 +4,7 @@ class Form::Sales::Questions::PurchasePrice < ::Form::Question
@id = "value"
@type = "numeric"
@min = form.start_year_2026_or_later? ? 15_000 : 0
@step = 0.01
@step = form.start_year_2026_or_later? ? 1 : 0.01 # 0.01 was a mistake that was fixed in 2026
@width = 5
@prefix = "£"
@ownership_sch = ownershipsch

12
lib/tasks/round_value_for_2026_sales_logs.rake

@ -0,0 +1,12 @@
desc "Rounds and value for sales logs in the database if they are not a whole number"
task round_value_for_2026_sales_logs: :environment do
ids = SalesLog.filter_by_year(2026).where("value % 1 != 0").pluck(:id)
puts "Correcting #{ids.count} sales logs, #{ids}"
# find all values of mortgage that are not a whole number
SalesLog.filter_by_year(2026).where("value % 1 != 0").find_each do |log|
log.update(value: log.value.round)
end
puts "Done"
end
Loading…
Cancel
Save