|
|
@ -56,6 +56,20 @@ class CaseLog < ApplicationRecord |
|
|
|
enum ecstat6: ECSTAT, _suffix: true |
|
|
|
enum ecstat6: ECSTAT, _suffix: true |
|
|
|
enum ecstat7: ECSTAT, _suffix: true |
|
|
|
enum ecstat7: ECSTAT, _suffix: true |
|
|
|
enum ecstat8: ECSTAT, _suffix: true |
|
|
|
enum ecstat8: ECSTAT, _suffix: true |
|
|
|
|
|
|
|
enum relat2: RELAT, _suffix: true |
|
|
|
|
|
|
|
enum relat3: RELAT, _suffix: true |
|
|
|
|
|
|
|
enum relat4: RELAT, _suffix: true |
|
|
|
|
|
|
|
enum relat5: RELAT, _suffix: true |
|
|
|
|
|
|
|
enum relat6: RELAT, _suffix: true |
|
|
|
|
|
|
|
enum relat7: RELAT, _suffix: true |
|
|
|
|
|
|
|
enum relat8: RELAT, _suffix: true |
|
|
|
|
|
|
|
enum sex2: GENDER, _suffix: true |
|
|
|
|
|
|
|
enum sex3: GENDER, _suffix: true |
|
|
|
|
|
|
|
enum sex4: GENDER, _suffix: true |
|
|
|
|
|
|
|
enum sex5: GENDER, _suffix: true |
|
|
|
|
|
|
|
enum sex6: GENDER, _suffix: true |
|
|
|
|
|
|
|
enum sex7: GENDER, _suffix: true |
|
|
|
|
|
|
|
enum sex8: GENDER, _suffix: true |
|
|
|
enum prevten: PREVIOUS_TENANCY, _suffix: true |
|
|
|
enum prevten: PREVIOUS_TENANCY, _suffix: true |
|
|
|
enum homeless: HOMELESS, _suffix: true |
|
|
|
enum homeless: HOMELESS, _suffix: true |
|
|
|
enum underoccupation_benefitcap: BENEFITCAP, _suffix: true |
|
|
|
enum underoccupation_benefitcap: BENEFITCAP, _suffix: true |
|
|
@ -119,7 +133,7 @@ class CaseLog < ApplicationRecord |
|
|
|
enum postcode_known: POLAR, _suffix: true |
|
|
|
enum postcode_known: POLAR, _suffix: true |
|
|
|
enum la_known: POLAR, _suffix: true |
|
|
|
enum la_known: POLAR, _suffix: true |
|
|
|
|
|
|
|
|
|
|
|
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at renttype lettype is_la_inferred].freeze |
|
|
|
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at renttype lettype is_la_inferred totchild].freeze |
|
|
|
OPTIONAL_FIELDS = %w[postcode_known |
|
|
|
OPTIONAL_FIELDS = %w[postcode_known |
|
|
|
la_known |
|
|
|
la_known |
|
|
|
first_time_property_let_as_social_housing].freeze |
|
|
|
first_time_property_let_as_social_housing].freeze |
|
|
@ -199,6 +213,12 @@ private |
|
|
|
self.lettype = "#{renttype} #{needstype} #{owning_organisation['Org type']}" if renttype.present? && needstype.present? && owning_organisation["Org type"].present? |
|
|
|
self.lettype = "#{renttype} #{needstype} #{owning_organisation['Org type']}" if renttype.present? && needstype.present? && owning_organisation["Org type"].present? |
|
|
|
self.is_la_inferred = false if is_la_inferred.nil? |
|
|
|
self.is_la_inferred = false if is_la_inferred.nil? |
|
|
|
self.la = get_la(property_postcode) |
|
|
|
self.la = get_la(property_postcode) |
|
|
|
|
|
|
|
self.totchild = get_totchild |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_totchild |
|
|
|
|
|
|
|
relationships = [relat2, relat3, relat4, relat5, relat6, relat7, relat8] |
|
|
|
|
|
|
|
relationships.count("Child - includes young adult and grown-up") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def get_la(postcode) |
|
|
|
def get_la(postcode) |
|
|
|