|
|
|
@ -25,7 +25,6 @@ class CaseLog < ApplicationRecord
|
|
|
|
|
before_validation :reset_scheme_location!, if: :scheme_changed?, unless: :location_changed? |
|
|
|
|
before_validation :process_postcode_changes!, if: :postcode_full_changed? |
|
|
|
|
before_validation :process_previous_postcode_changes!, if: :ppostcode_full_changed? |
|
|
|
|
before_validation :set_housingneeds_fields, if: :housingneeds? |
|
|
|
|
before_validation :reset_invalidated_dependent_fields! |
|
|
|
|
before_validation :reset_location_fields!, unless: :postcode_known? |
|
|
|
|
before_validation :reset_previous_location_fields!, unless: :previous_postcode_known? |
|
|
|
@ -759,25 +758,4 @@ private
|
|
|
|
|
def unknown_housingneeds? |
|
|
|
|
housingneeds == 3 |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def set_housingneeds_fields |
|
|
|
|
set_housingneeds_values_to_zero |
|
|
|
|
|
|
|
|
|
self.housingneeds_a = 1 if fully_wheelchair_accessible? |
|
|
|
|
self.housingneeds_b = 1 if essential_wheelchair_access? |
|
|
|
|
self.housingneeds_c = 1 if level_access_housing? |
|
|
|
|
self.housingneeds_f = 1 if other_housingneeds? |
|
|
|
|
set_housingneeds_values_to_zero unless has_housingneeds? |
|
|
|
|
self.housingneeds_g = 1 if no_housingneeds? |
|
|
|
|
self.housingneeds_h = 1 if unknown_housingneeds? |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def set_housingneeds_values_to_zero |
|
|
|
|
self.housingneeds_a = 0 |
|
|
|
|
self.housingneeds_b = 0 |
|
|
|
|
self.housingneeds_c = 0 |
|
|
|
|
self.housingneeds_f = 0 |
|
|
|
|
self.housingneeds_g = 0 |
|
|
|
|
self.housingneeds_h = 0 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|