|
|
|
@ -23,7 +23,6 @@ class SalesLog < Log |
|
|
|
before_validation :reset_invalidated_dependent_fields! |
|
|
|
before_validation :reset_invalidated_dependent_fields! |
|
|
|
before_validation :process_previous_postcode_changes!, if: :ppostcode_full_changed? |
|
|
|
before_validation :process_previous_postcode_changes!, if: :ppostcode_full_changed? |
|
|
|
before_validation :reset_previous_location_fields!, unless: :previous_postcode_known? |
|
|
|
before_validation :reset_previous_location_fields!, unless: :previous_postcode_known? |
|
|
|
before_validation :process_mscharge_known_changes!, if: :mscharge_known_changed? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scope :filter_by_year, ->(year) { where(saledate: Time.zone.local(year.to_i, 4, 1)...Time.zone.local(year.to_i + 1, 4, 1)) } |
|
|
|
scope :filter_by_year, ->(year) { where(saledate: Time.zone.local(year.to_i, 4, 1)...Time.zone.local(year.to_i + 1, 4, 1)) } |
|
|
|
scope :search_by, ->(param) { filter_by_id(param) } |
|
|
|
scope :search_by, ->(param) { filter_by_id(param) } |
|
|
|
@ -152,10 +151,4 @@ class SalesLog < Log |
|
|
|
def mortgage_not_used? |
|
|
|
def mortgage_not_used? |
|
|
|
mortgageused == 2 |
|
|
|
mortgageused == 2 |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def process_mscharge_known_changes! |
|
|
|
|
|
|
|
return if mscharge_known.blank? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self["mscharge"] = 0 if mscharge_known.zero? |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|