diff --git a/app/models/derived_variables/case_log_variables.rb b/app/models/derived_variables/case_log_variables.rb index 29fe4adb3..cf51c6a49 100644 --- a/app/models/derived_variables/case_log_variables.rb +++ b/app/models/derived_variables/case_log_variables.rb @@ -189,15 +189,13 @@ private 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? + self.housingneeds_a = fully_wheelchair_accessible? ? 1 : 0 + self.housingneeds_b = essential_wheelchair_access? ? 1 : 0 + self.housingneeds_c = level_access_housing? ? 1 : 0 + self.housingneeds_f = other_housingneeds? ? 1 : 0 set_housingneeds_values_to_zero unless has_housingneeds? - self.housingneeds_g = 1 if no_housingneeds? - self.housingneeds_h = 1 if unknown_housingneeds? + self.housingneeds_g = no_housingneeds? ? 1 : 0 + self.housingneeds_h = unknown_housingneeds? ? 1 : 0 end def set_housingneeds_values_to_zero