Browse Source

CLDC-2665 Switch lettings ppcodenk (#1854)

* Switch lettings ppcodenk

* Address Kat's comment

* separate process postcode methods

* tests

* Update row parsers

* Update conditionals

* Add rake task to update ppcodenk

* Bring back value_is_no?

---------

Co-authored-by: Kat <katrina@kosiak.co.uk>
pull/1880/head
Jack 1 year ago committed by GitHub
parent
commit
abf9aa07a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/models/form/lettings/questions/ppcodenk.rb
  2. 7
      app/models/form/lettings/questions/ppostcode_full.rb
  3. 23
      app/models/form/question.rb
  4. 24
      app/models/lettings_log.rb
  5. 5
      app/models/log.rb
  6. 26
      app/models/sales_log.rb
  7. 4
      app/services/bulk_upload/lettings/year2022/row_parser.rb
  8. 4
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  9. 4
      app/services/imports/lettings_logs_import_service.rb
  10. 8
      config/forms/2021_2022.json
  11. 8
      config/forms/2022_2023.json
  12. 6
      lib/tasks/correct_ppcodenk_values.rake
  13. 2
      spec/factories/lettings_log.rb
  14. 2
      spec/fixtures/exports/general_needs_log.xml
  15. 2
      spec/fixtures/exports/general_needs_log_23_24.xml
  16. 2
      spec/fixtures/exports/supported_housing_logs.xml
  17. 2
      spec/fixtures/files/lettings_log_csv_export_codes.csv
  18. 2
      spec/fixtures/files/lettings_log_csv_export_non_support_codes.csv
  19. 67
      spec/lib/tasks/correct_ppcodenk_values_spec.rb
  20. 50
      spec/models/form/question_spec.rb
  21. 8
      spec/models/lettings_log_spec.rb
  22. 40
      spec/models/validations/local_authority_validations_spec.rb
  23. 4
      spec/services/bulk_upload/lettings/log_creator_spec.rb
  24. 2
      spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb
  25. 2
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
  26. 4
      spec/services/bulk_upload/processor_spec.rb

7
app/models/form/lettings/questions/ppcodenk.rb

@ -8,11 +8,14 @@ class Form::Lettings::Questions::Ppcodenk < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "This is also known as the household’s ‘last settled home’." @hint_text = "This is also known as the household’s ‘last settled home’."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { "ppostcode_full" => [1] } @conditional_for = { "ppostcode_full" => [0] }
@hidden_in_check_answers = { "depends_on" => [{ "ppcodenk" => 0 }, { "ppcodenk" => 1 }] } @hidden_in_check_answers = { "depends_on" => [{ "ppcodenk" => 0 }, { "ppcodenk" => 1 }] }
@question_number = 80 @question_number = 80
@disable_clearing_if_not_routed_or_dynamic_answer_options = true @disable_clearing_if_not_routed_or_dynamic_answer_options = true
end end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze ANSWER_OPTIONS = {
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
}.freeze
end end

7
app/models/form/lettings/questions/ppostcode_full.rb

@ -6,7 +6,12 @@ class Form::Lettings::Questions::PpostcodeFull < ::Form::Question
@header = "Postcode for the previous accommodation" @header = "Postcode for the previous accommodation"
@type = "text" @type = "text"
@width = 5 @width = 5
@inferred_check_answers_value = [{ "condition" => { "ppcodenk" => 0 }, "value" => "Not known" }] @inferred_check_answers_value = [{
"condition" => {
"ppcodenk" => 1,
},
"value" => "Not known",
}]
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@inferred_answers = { "prevloc" => { "is_previous_la_inferred" => true } } @inferred_answers = { "prevloc" => { "is_previous_la_inferred" => true } }

23
app/models/form/question.rb

@ -116,20 +116,20 @@ class Form::Question
if is_derived_or_has_inferred_check_answers_value?(log) if is_derived_or_has_inferred_check_answers_value?(log)
"Change" "Change"
elsif type == "checkbox" elsif type == "checkbox"
answer_options.keys.any? { |key| value_is_yes?(log[key], log.lettings?) } ? "Change" : "Answer" answer_options.keys.any? { |key| value_is_yes?(log[key]) } ? "Change" : "Answer"
else else
log[id].blank? ? "Answer" : "Change" log[id].blank? ? "Answer" : "Change"
end end
end end
def unanswered?(log) def unanswered?(log)
return answer_options.keys.none? { |key| value_is_yes?(log[key], log.lettings?) } if type == "checkbox" return answer_options.keys.none? { |key| value_is_yes?(log[key]) } if type == "checkbox"
log[id].blank? log[id].blank?
end end
def completed?(log) def completed?(log)
return answer_options.keys.any? { |key| value_is_yes?(log[key], log.lettings?) } if type == "checkbox" return answer_options.keys.any? { |key| value_is_yes?(log[key]) } if type == "checkbox"
log[id].present? || !log.respond_to?(id.to_sym) || has_inferred_display_value?(log) log[id].present? || !log.respond_to?(id.to_sym) || has_inferred_display_value?(log)
end end
@ -166,18 +166,18 @@ class Form::Question
label || value.to_s label || value.to_s
end end
def value_is_yes?(value, is_lettings) def value_is_yes?(value)
case type case type
when "checkbox" when "checkbox"
value == 1 value == 1
when "radio" when "radio"
is_lettings ? RADIO_YES_VALUE_LETTINGS[id.to_sym]&.include?(value) : RADIO_YES_VALUE_SALES[id.to_sym]&.include?(value) RADIO_YES_VALUE[id.to_sym]&.include?(value)
else else
%w[yes].include?(value.downcase) %w[yes].include?(value.downcase)
end end
end end
def value_is_no?(value, is_lettings) def value_is_no?(value)
case type case type
when "checkbox" when "checkbox"
value && value.zero? value && value.zero?
@ -272,9 +272,9 @@ private
def checkbox_answer_label(log) def checkbox_answer_label(log)
answer = [] answer = []
return "Yes" if id == "declaration" && value_is_yes?(log["declaration"], log.lettings?) return "Yes" if id == "declaration" && value_is_yes?(log["declaration"])
answer_options.each { |key, options| value_is_yes?(log[key], log.lettings?) ? answer << options["value"] : nil } answer_options.each { |key, options| value_is_yes?(log[key]) ? answer << options["value"] : nil }
answer.join(", ") answer.join(", ")
end end
@ -338,6 +338,7 @@ private
is_carehome: [1], is_carehome: [1],
hbrentshortfall: [1], hbrentshortfall: [1],
net_income_value_check: [0], net_income_value_check: [0],
ppcodenk: [0],
}.freeze }.freeze
RADIO_NO_VALUE = { RADIO_NO_VALUE = {
@ -362,13 +363,9 @@ private
is_carehome: [0], is_carehome: [0],
hbrentshortfall: [2], hbrentshortfall: [2],
net_income_value_check: [1], net_income_value_check: [1],
ppcodenk: [1],
}.freeze }.freeze
RADIO_YES_VALUE_LETTINGS = RADIO_YES_VALUE.merge({ ppcodenk: [1] })
RADIO_YES_VALUE_SALES = RADIO_YES_VALUE.merge({ ppcodenk: [0] })
RADIO_NO_VALUE_LETTINGS = RADIO_NO_VALUE.merge({ ppcodenk: [0] })
RADIO_NO_VALUE_SALES = RADIO_NO_VALUE.merge({ ppcodenk: [1] })
RADIO_DONT_KNOW_VALUE = { RADIO_DONT_KNOW_VALUE = {
sheltered: [3], sheltered: [3],
underoccupation_benefitcap: [3], underoccupation_benefitcap: [3],

24
app/models/lettings_log.rb

@ -260,8 +260,8 @@ class LettingsLog < Log
end end
def previous_postcode_known? def previous_postcode_known?
# 1: Yes # 0: Yes
ppcodenk == 1 ppcodenk&.zero?
end end
def previous_la_known? def previous_la_known?
@ -628,16 +628,22 @@ private
def process_postcode_changes! def process_postcode_changes!
self.postcode_full = upcase_and_remove_whitespace(postcode_full) self.postcode_full = upcase_and_remove_whitespace(postcode_full)
process_postcode(postcode_full, "postcode_known", "is_la_inferred", "la") return if postcode_full.blank?
self.postcode_known = 1
inferred_la = get_inferred_la(postcode_full)
self.is_la_inferred = inferred_la.present?
self.la = inferred_la if inferred_la.present?
end end
def process_postcode(postcode, postcode_known_key, la_inferred_key, la_key) def process_previous_postcode_changes!
return if postcode.blank? self.ppostcode_full = upcase_and_remove_whitespace(ppostcode_full)
return if ppostcode_full.blank?
self[postcode_known_key] = 1 self.ppcodenk = 0
inferred_la = get_inferred_la(postcode) inferred_la = get_inferred_la(ppostcode_full)
self[la_inferred_key] = inferred_la.present? self.is_previous_la_inferred = inferred_la.present?
self[la_key] = inferred_la if inferred_la.present? self.prevloc = inferred_la if inferred_la.present?
end end
def get_has_benefits def get_has_benefits

5
app/models/log.rb

@ -232,11 +232,6 @@ private
PIO = PostcodeService.new PIO = PostcodeService.new
def process_previous_postcode_changes!
self.ppostcode_full = upcase_and_remove_whitespace(ppostcode_full)
process_postcode(ppostcode_full, "ppcodenk", "is_previous_la_inferred", "prevloc")
end
LA_CHANGES = { LA_CHANGES = {
"E07000027" => "E06000064", # Barrow-in-Furness => Westmorland and Furness "E07000027" => "E06000064", # Barrow-in-Furness => Westmorland and Furness
"E07000030" => "E06000064", # Eden => Westmorland and Furness "E07000030" => "E06000064", # Eden => Westmorland and Furness

26
app/models/sales_log.rb

@ -278,15 +278,6 @@ class SalesLog < Log
mortgage + deposit mortgage + deposit
end end
def process_postcode(postcode, postcode_known_key, la_inferred_key, la_key)
return if postcode.blank?
self[postcode_known_key] = 0
inferred_la = get_inferred_la(postcode)
self[la_inferred_key] = inferred_la.present?
self[la_key] = inferred_la if inferred_la.present?
end
def outright_sale? def outright_sale?
ownershipsch == 3 ownershipsch == 3
end end
@ -305,7 +296,22 @@ class SalesLog < Log
def process_postcode_changes! def process_postcode_changes!
self.postcode_full = upcase_and_remove_whitespace(postcode_full) self.postcode_full = upcase_and_remove_whitespace(postcode_full)
process_postcode(postcode_full, "pcodenk", "is_la_inferred", "la") return if postcode_full.blank?
self.pcodenk = 0
inferred_la = get_inferred_la(postcode_full)
self.is_la_inferred = inferred_la.present?
self.la = inferred_la if inferred_la.present?
end
def process_previous_postcode_changes!
self.ppostcode_full = upcase_and_remove_whitespace(ppostcode_full)
return if ppostcode_full.blank?
self.ppcodenk = 0
inferred_la = get_inferred_la(ppostcode_full)
self.is_previous_la_inferred = inferred_la.present?
self.prevloc = inferred_la if inferred_la.present?
end end
def reset_created_by! def reset_created_by!

4
app/services/bulk_upload/lettings/year2022/row_parser.rb

@ -1285,9 +1285,9 @@ private
def ppcodenk def ppcodenk
case field_65 case field_65
when 1 when 1
1
when 2
0 0
when 2
1
end end
end end

4
app/services/bulk_upload/lettings/year2023/row_parser.rb

@ -1424,9 +1424,9 @@ private
def ppcodenk def ppcodenk
case field_106 case field_106
when 1 when 1
1
when 2
0 0
when 2
1
end end
end end

4
app/services/imports/lettings_logs_import_service.rb

@ -465,11 +465,11 @@ module Imports
def previous_postcode_known(xml_doc, previous_postcode, prevloc) def previous_postcode_known(xml_doc, previous_postcode, prevloc)
previous_postcode_known = string_or_nil(xml_doc, "Q12bnot") previous_postcode_known = string_or_nil(xml_doc, "Q12bnot")
if previous_postcode_known == "Temporary_or_Unknown" || (previous_postcode.nil? && prevloc.present?) if previous_postcode_known == "Temporary_or_Unknown" || (previous_postcode.nil? && prevloc.present?)
0 # not known 1 # not known
elsif previous_postcode.nil? elsif previous_postcode.nil?
nil nil
else else
1 # known 0 # known
end end
end end

8
config/forms/2021_2022.json

@ -6488,15 +6488,15 @@
"disable_clearing_if_not_routed_or_dynamic_answer_options": true, "disable_clearing_if_not_routed_or_dynamic_answer_options": true,
"answer_options": { "answer_options": {
"1": { "1": {
"value": "Yes" "value": "No"
}, },
"0": { "0": {
"value": "No" "value": "Yes"
} }
}, },
"conditional_for": { "conditional_for": {
"ppostcode_full": [ "ppostcode_full": [
1 0
] ]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
@ -6524,7 +6524,7 @@
}, },
"inferred_check_answers_value": [{ "inferred_check_answers_value": [{
"condition": { "condition": {
"ppcodenk": 0 "ppcodenk": 1
}, },
"value": "Not known" "value": "Not known"
}] }]

8
config/forms/2022_2023.json

@ -6388,16 +6388,16 @@
"type": "radio", "type": "radio",
"disable_clearing_if_not_routed_or_dynamic_answer_options": true, "disable_clearing_if_not_routed_or_dynamic_answer_options": true,
"answer_options": { "answer_options": {
"1": { "0": {
"value": "Yes" "value": "Yes"
}, },
"0": { "1": {
"value": "No" "value": "No"
} }
}, },
"conditional_for": { "conditional_for": {
"ppostcode_full": [ "ppostcode_full": [
1 0
] ]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
@ -6425,7 +6425,7 @@
}, },
"inferred_check_answers_value": [{ "inferred_check_answers_value": [{
"condition": { "condition": {
"ppcodenk": 0 "ppcodenk": 1
}, },
"value": "Not known" "value": "Not known"
}] }]

6
lib/tasks/correct_ppcodenk_values.rake

@ -0,0 +1,6 @@
desc "Alter ppcodenk values for non imported lettings logs in the database"
task correct_ppcodenk_values: :environment do
LettingsLog.where.not(ppcodenk: nil).find_each do |log|
log.update_columns(ppcodenk: log.ppcodenk == 1 ? 0 : 1)
end
end

2
spec/factories/lettings_log.rb

@ -166,7 +166,7 @@ FactoryBot.define do
joint { 3 } joint { 3 }
address_line1 { "fake address" } address_line1 { "fake address" }
town_or_city { "London" } town_or_city { "London" }
ppcodenk { 0 } ppcodenk { 1 }
tshortfall_known { 1 } tshortfall_known { 1 }
end end
trait :export do trait :export do

2
spec/fixtures/exports/general_needs_log.xml vendored

@ -109,7 +109,7 @@
<tcharge>325.0</tcharge> <tcharge>325.0</tcharge>
<tshortfall>12.0</tshortfall> <tshortfall>12.0</tshortfall>
<chcharge/> <chcharge/>
<ppcodenk>1</ppcodenk> <ppcodenk>0</ppcodenk>
<has_benefits>1</has_benefits> <has_benefits>1</has_benefits>
<renewal>0</renewal> <renewal>0</renewal>
<wrent>100.0</wrent> <wrent>100.0</wrent>

2
spec/fixtures/exports/general_needs_log_23_24.xml vendored

@ -109,7 +109,7 @@
<tcharge>325.0</tcharge> <tcharge>325.0</tcharge>
<tshortfall>12.0</tshortfall> <tshortfall>12.0</tshortfall>
<chcharge/> <chcharge/>
<ppcodenk>1</ppcodenk> <ppcodenk>0</ppcodenk>
<has_benefits>1</has_benefits> <has_benefits>1</has_benefits>
<renewal>0</renewal> <renewal>0</renewal>
<wrent>100.0</wrent> <wrent>100.0</wrent>

2
spec/fixtures/exports/supported_housing_logs.xml vendored

@ -108,7 +108,7 @@
<tcharge>325.0</tcharge> <tcharge>325.0</tcharge>
<tshortfall>12.0</tshortfall> <tshortfall>12.0</tshortfall>
<chcharge/> <chcharge/>
<ppcodenk>1</ppcodenk> <ppcodenk>0</ppcodenk>
<has_benefits>1</has_benefits> <has_benefits>1</has_benefits>
<renewal>0</renewal> <renewal>0</renewal>
<wrent>100.0</wrent> <wrent>100.0</wrent>

2
spec/fixtures/files/lettings_log_csv_export_codes.csv vendored

@ -1,2 +1,2 @@
id,status,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,age1_known,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2_known,age2,sex2,ecstat2,details_known_3,relat3,age3_known,age3,sex3,ecstat3,details_known_4,relat4,age4_known,age4,sex4,ecstat4,details_known_5,relat5,age5_known,age5,sex5,ecstat5,details_known_6,relat6,age6_known,age6,sex6,ecstat6,details_known_7,relat7,age7_known,age7,sex7,ecstat7,details_known_8,relat8,age8_known,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,new_old,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_unknown,referral,net_income_known,incref,earnings,incfreq,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_startdate id,status,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,age1_known,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2_known,age2,sex2,ecstat2,details_known_3,relat3,age3_known,age3,sex3,ecstat3,details_known_4,relat4,age4_known,age4,sex4,ecstat4,details_known_5,relat5,age5_known,age5,sex5,ecstat5,details_known_6,relat6,age6_known,age6,sex6,ecstat6,details_known_7,relat7,age7_known,age7,sex7,ecstat7,details_known_8,relat8,age8_known,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,new_old,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_unknown,referral,net_income_known,incref,earnings,incfreq,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_startdate
,completed,s.port@jeemayle.com,false,2023-06-26T00:00:00+01:00,,2023-06-26T00:00:00+01:00,1,,,2023,DLUHC,DLUHC,1,7,0,2023-06-26T00:00:00+01:00,2,1,,,,HIJKLMN,ABCDEFG,0,,,fake address,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-06-24T00:00:00+01:00,,,1,2023-06-25T00:00:00+01:00,,3,1,4,,2,,1,2,,0,0,4,0,0,2,35,,F,0,2,13,0,0,P,0,32,M,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,2,1,1,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,,2,0,0,68,1,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, ,completed,s.port@jeemayle.com,false,2023-06-26T00:00:00+01:00,,2023-06-26T00:00:00+01:00,1,,,2023,DLUHC,DLUHC,1,7,0,2023-06-26T00:00:00+01:00,2,1,,,,HIJKLMN,ABCDEFG,0,,,fake address,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-06-24T00:00:00+01:00,,,1,2023-06-25T00:00:00+01:00,,3,1,4,,2,,1,2,,0,0,4,0,0,2,35,,F,0,2,13,0,0,P,0,32,M,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,2,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,,2,0,0,68,1,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,,

1 id status created_by is_dpo created_at updated_by updated_at creation_method old_id old_form_id collection_start_year owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype rent_type_detail irproduct irproduct_other lar tenancycode propcode uprn_known uprn uprn_confirmed address_line1 address_line2 town_or_city county postcode_full is_la_inferred la_label la first_time_property_let_as_social_housing unitletas rsnvac newprop offered unittype_gn builtype wchair beds voiddate vacdays void_date_value_check majorrepairs mrcdate major_repairs_date_value_check joint startertenancy tenancy tenancyother tenancylength sheltered declaration hhmemb pregnancy_value_check age1_known refused hhtype totchild totelder totadult age1 retirement_value_check sex1 ethnic_group ethnic national ecstat1 details_known_2 relat2 age2_known age2 sex2 ecstat2 details_known_3 relat3 age3_known age3 sex3 ecstat3 details_known_4 relat4 age4_known age4 sex4 ecstat4 details_known_5 relat5 age5_known age5 sex5 ecstat5 details_known_6 relat6 age6_known age6 sex6 ecstat6 details_known_7 relat7 age7_known age7 sex7 ecstat7 details_known_8 relat8 age8_known age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother prevten new_old homeless ppcodenk ppostcode_full previous_la_known is_previous_la_inferred prevloc_label prevloc reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr letting_allocation_unknown referral net_income_known incref earnings incfreq net_income_value_check hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg carehome_charges_value_check brent wrent rent_value_check scharge wscharge pscharge wpschrge supcharg wsupchrg tcharge wtcharge hbrentshortfall tshortfall_known tshortfall wtshortfall scheme_code scheme_service_name scheme_sensitive SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_admin_district location_startdate
2 completed s.port@jeemayle.com false 2023-06-26T00:00:00+01:00 2023-06-26T00:00:00+01:00 1 2023 DLUHC DLUHC 1 7 0 2023-06-26T00:00:00+01:00 2 1 HIJKLMN ABCDEFG 0 fake address London NW9 5LL false Barnet E09000003 0 2 6 2 2 7 1 1 3 2023-06-24T00:00:00+01:00 1 2023-06-25T00:00:00+01:00 3 1 4 2 1 2 0 0 4 0 0 2 35 F 0 2 13 0 0 P 0 32 M 6 1 4 1 2 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 2 7 4 6 2 1 1 0 TN23 6LZ 1 false Ashford E07000105 1 0 1 0 0 0 0 0 1 2 0 0 68 1 6 1 1 0 2 200.0 100.0 50.0 25.0 40.0 20.0 35.0 17.5 325.0 162.5 1 0 12.0 6.0

2
spec/fixtures/files/lettings_log_csv_export_non_support_codes.csv vendored

@ -1,2 +1,2 @@
id,status,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,lettype,renewal,startdate,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,referral,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_startdate id,status,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,lettype,renewal,startdate,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,referral,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_startdate
,completed,choreographer@owtluk.com,false,2023-06-26T00:00:00+01:00,,2023-06-26T00:00:00+01:00,1,2023,DLUHC,DLUHC,7,0,2023-06-26T00:00:00+01:00,,,,HIJKLMN,ABCDEFG,0,,fake address,,London,,NW9 5LL,Barnet,2,6,2,2,7,1,1,3,2023-06-24T00:00:00+01:00,,1,2023-06-25T00:00:00+01:00,,3,1,4,,2,,1,0,35,F,0,2,13,0,P,32,M,6,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,1,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,2,0,68,1,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,, ,completed,choreographer@owtluk.com,false,2023-06-26T00:00:00+01:00,,2023-06-26T00:00:00+01:00,1,2023,DLUHC,DLUHC,7,0,2023-06-26T00:00:00+01:00,,,,HIJKLMN,ABCDEFG,0,,fake address,,London,,NW9 5LL,Barnet,2,6,2,2,7,1,1,3,2023-06-24T00:00:00+01:00,,1,2023-06-25T00:00:00+01:00,,3,1,4,,2,,1,0,35,F,0,2,13,0,P,32,M,6,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,2,0,68,1,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,,

1 id status created_by is_dpo created_at updated_by updated_at creation_method collection_start_year owning_organisation_name managing_organisation_name lettype renewal startdate irproduct irproduct_other lar tenancycode propcode uprn_known uprn address_line1 address_line2 town_or_city county postcode_full la_label unitletas rsnvac newprop offered unittype_gn builtype wchair beds voiddate void_date_value_check majorrepairs mrcdate major_repairs_date_value_check joint startertenancy tenancy tenancyother tenancylength sheltered declaration refused age1 sex1 ethnic_group ethnic national ecstat1 relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 sex7 ecstat7 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother prevten homeless ppcodenk ppostcode_full prevloc_label reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr referral incref earnings incfreq hb has_benefits benefits household_charge nocharge period chcharge wchchrg carehome_charges_value_check brent scharge pscharge supcharg tcharge hbrentshortfall tshortfall scheme_code scheme_service_name scheme_sensitive SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_admin_district location_startdate
2 completed choreographer@owtluk.com false 2023-06-26T00:00:00+01:00 2023-06-26T00:00:00+01:00 1 2023 DLUHC DLUHC 7 0 2023-06-26T00:00:00+01:00 HIJKLMN ABCDEFG 0 fake address London NW9 5LL Barnet 2 6 2 2 7 1 1 3 2023-06-24T00:00:00+01:00 1 2023-06-25T00:00:00+01:00 3 1 4 2 1 0 35 F 0 2 13 0 P 32 M 6 1 4 1 2 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 2 7 4 6 1 1 0 TN23 6LZ Ashford 1 0 1 0 0 0 0 0 1 2 0 68 1 6 1 1 0 2 200.0 50.0 40.0 35.0 325.0 1 12.0

67
spec/lib/tasks/correct_ppcodenk_values_spec.rb

@ -0,0 +1,67 @@
require "rails_helper"
require "rake"
RSpec.describe "correct_ppcodenk_values" do
describe ":correct_ppcodenk_values", type: :task do
subject(:task) { Rake::Task["correct_ppcodenk_values"] }
before do
Rake.application.rake_require("tasks/correct_ppcodenk_values")
Rake::Task.define_task(:environment)
task.reenable
end
context "when the rake task is run" do
let!(:lettings_log) { create(:lettings_log, :completed) }
it "updates lettings logs with ppcodenk 0 to have ppcodenk 1" do
lettings_log.update!(ppcodenk: 0)
task.invoke
expect(lettings_log.reload.ppcodenk).to eq(1)
end
it "updates lettings logs with ppcodenk 1 to have ppcodenk 0" do
lettings_log.update!(ppcodenk: 1)
task.invoke
expect(lettings_log.reload.ppcodenk).to eq(0)
end
it "does not update lettings logs with ppcodenk nil" do
lettings_log.update!(ppcodenk: nil)
task.invoke
expect(lettings_log.reload.ppcodenk).to eq(nil)
end
context "with multiple lettings logs" do
let(:lettings_log_2) { create(:lettings_log, :completed) }
let(:lettings_log_3) { create(:lettings_log, :completed) }
it "only updates each log once" do
lettings_log.update!(ppcodenk: nil)
lettings_log_2.update!(ppcodenk: 0)
lettings_log_3.update!(ppcodenk: 1)
task.invoke
expect(lettings_log.reload.ppcodenk).to eq(nil)
expect(lettings_log_2.reload.ppcodenk).to eq(1)
expect(lettings_log_3.reload.ppcodenk).to eq(0)
end
end
it "does not update updated_at value" do
lettings_log.updated_at = Time.zone.local(2021, 3, 3)
lettings_log.save!(validate: false)
expect(lettings_log.updated_at.to_date).to eq(Time.zone.local(2021, 3, 3))
task.invoke
expect(lettings_log.updated_at.to_date).to eq(Time.zone.local(2021, 3, 3))
end
it "skips validations for previous years" do
lettings_log.update!(ppcodenk: 1)
lettings_log.startdate = Time.zone.local(2021, 3, 3)
lettings_log.save!(validate: false)
task.invoke
expect(lettings_log.reload.ppcodenk).to eq(0)
end
end
end
end

50
spec/models/form/question_spec.rb

@ -60,37 +60,9 @@ RSpec.describe Form::Question, type: :model do
end end
it "has a yes value helper" do it "has a yes value helper" do
expect(question).to be_value_is_yes("Yes", true) expect(question).to be_value_is_yes("Yes")
expect(question).to be_value_is_yes("YES", true) expect(question).to be_value_is_yes("YES")
expect(question).not_to be_value_is_yes("random", true) expect(question).not_to be_value_is_yes("random")
end
it "has a no value helper" do
expect(question).to be_value_is_no("No", true)
expect(question).to be_value_is_no("NO", true)
expect(question).not_to be_value_is_no("random", true)
end
context "when there are different value helper values for lettings and sales" do
context "with a lettings log" do
let(:lettings_log) { FactoryBot.build(:lettings_log, :in_progress) }
let(:question) { Form::Lettings::Questions::Ppcodenk.new(nil, nil, Form::Lettings::Pages::PreviousPostcode.new("previous_postcode", nil, Form::Lettings::Subsections::HouseholdSituation.new(nil, nil, Form::Lettings::Sections::Household))) }
it "has the correct values" do
expect(question.value_is_yes?(1, lettings_log.lettings?)).to be true
expect(question.value_is_no?(0, lettings_log.lettings?)).to be true
end
end
context "with a sales log" do
let(:sales_log) { FactoryBot.build(:sales_log, :in_progress) }
let(:question) { Form::Sales::Questions::PreviousPostcodeKnown.new(nil, nil, Form::Sales::Pages::LastAccommodation.new("previous_postcode", nil, Form::Sales::Subsections::HouseholdSituation.new(nil, nil, Form::Sales::Sections::Household))) }
it "has the correct values" do
expect(question.value_is_yes?(0, sales_log.lettings?)).to be true
expect(question.value_is_no?(1, sales_log.lettings?)).to be true
end
end
end end
context "when type is numeric" do context "when type is numeric" do
@ -130,10 +102,8 @@ RSpec.describe Form::Question, type: :model do
let(:question_id) { "illness" } let(:question_id) { "illness" }
it "maps those options" do it "maps those options" do
expect(question).to be_value_is_yes(1, true) expect(question).to be_value_is_yes(1)
expect(question).not_to be_value_is_no(1, true)
expect(question).not_to be_value_is_refused(1) expect(question).not_to be_value_is_refused(1)
expect(question).to be_value_is_no(2, true)
expect(question).to be_value_is_dont_know(3) expect(question).to be_value_is_dont_know(3)
end end
end end
@ -145,8 +115,7 @@ RSpec.describe Form::Question, type: :model do
let(:question_id) { "layear" } let(:question_id) { "layear" }
it "maps those options" do it "maps those options" do
expect(question).not_to be_value_is_yes(7, true) expect(question).not_to be_value_is_yes(7)
expect(question).not_to be_value_is_no(7, true)
expect(question).not_to be_value_is_refused(7) expect(question).not_to be_value_is_refused(7)
expect(question).to be_value_is_dont_know(7) expect(question).to be_value_is_dont_know(7)
end end
@ -231,13 +200,8 @@ RSpec.describe Form::Question, type: :model do
end end
it "can map yes values" do it "can map yes values" do
expect(question).to be_value_is_yes(1, true) expect(question).to be_value_is_yes(1)
expect(question).not_to be_value_is_yes(0, true) expect(question).not_to be_value_is_yes(0)
end
it "can map no values" do
expect(question).to be_value_is_no(0, true)
expect(question).not_to be_value_is_no(1, true)
end end
end end

8
spec/models/lettings_log_spec.rb

@ -1329,7 +1329,7 @@ RSpec.describe LettingsLog do
managing_organisation: owning_organisation, managing_organisation: owning_organisation,
owning_organisation:, owning_organisation:,
created_by: created_by_user, created_by: created_by_user,
ppcodenk: 1, ppcodenk: 0,
ppostcode_full: "M1 1AE", ppostcode_full: "M1 1AE",
}) })
end end
@ -1369,7 +1369,7 @@ RSpec.describe LettingsLog do
end end
it "correctly resets all fields if previous postcode not known" do it "correctly resets all fields if previous postcode not known" do
address_lettings_log.update!({ ppcodenk: 0 }) address_lettings_log.update!({ ppcodenk: 1 })
record_from_db = described_class.find(address_lettings_log.id) record_from_db = described_class.find(address_lettings_log.id)
expect(record_from_db["ppostcode_full"]).to eq(nil) expect(record_from_db["ppostcode_full"]).to eq(nil)
@ -1378,7 +1378,7 @@ RSpec.describe LettingsLog do
end end
it "correctly resets la if la is not known" do it "correctly resets la if la is not known" do
address_lettings_log.update!({ ppcodenk: 0 }) address_lettings_log.update!({ ppcodenk: 1 })
address_lettings_log.update!({ previous_la_known: 1, prevloc: "S92000003" }) address_lettings_log.update!({ previous_la_known: 1, prevloc: "S92000003" })
record_from_db = described_class.find(address_lettings_log.id) record_from_db = described_class.find(address_lettings_log.id)
expect(record_from_db["prevloc"]).to eq("S92000003") expect(record_from_db["prevloc"]).to eq("S92000003")
@ -1391,7 +1391,7 @@ RSpec.describe LettingsLog do
end end
it "changes the prevloc if previous postcode changes from not known to known and provided" do it "changes the prevloc if previous postcode changes from not known to known and provided" do
address_lettings_log.update!({ ppcodenk: 0 }) address_lettings_log.update!({ ppcodenk: 1 })
address_lettings_log.update!({ previous_la_known: 1, prevloc: "E09000033" }) address_lettings_log.update!({ previous_la_known: 1, prevloc: "E09000033" })
record_from_db = described_class.find(address_lettings_log.id) record_from_db = described_class.find(address_lettings_log.id)

40
spec/models/validations/local_authority_validations_spec.rb

@ -4,35 +4,35 @@ RSpec.describe Validations::LocalAuthorityValidations do
subject(:local_auth_validator) { validator_class.new } subject(:local_auth_validator) { validator_class.new }
let(:validator_class) { Class.new { include Validations::LocalAuthorityValidations } } let(:validator_class) { Class.new { include Validations::LocalAuthorityValidations } }
let(:record) { FactoryBot.create(:lettings_log) } let(:log) { create(:lettings_log) }
describe "#validate_previous_accommodation_postcode" do describe "#validate_previous_accommodation_postcode" do
it "does not add an error if the record ppostcode_full is missing" do it "does not add an error if the log ppostcode_full is missing" do
record.ppostcode_full = nil log.ppostcode_full = nil
local_auth_validator.validate_previous_accommodation_postcode(record) local_auth_validator.validate_previous_accommodation_postcode(log)
expect(record.errors).to be_empty expect(log.errors).to be_empty
end end
it "does not add an error if the record ppostcode_full is valid (uppercase space)" do it "does not add an error if the log ppostcode_full is valid (uppercase space)" do
record.ppcodenk = 1 log.ppcodenk = 0
record.ppostcode_full = "M1 1AE" log.ppostcode_full = "M1 1AE"
local_auth_validator.validate_previous_accommodation_postcode(record) local_auth_validator.validate_previous_accommodation_postcode(log)
expect(record.errors).to be_empty expect(log.errors).to be_empty
end end
it "does not add an error if the record ppostcode_full is valid (lowercase no space)" do it "does not add an error if the log ppostcode_full is valid (lowercase no space)" do
record.ppcodenk = 1 log.ppcodenk = 0
record.ppostcode_full = "m11ae" log.ppostcode_full = "m11ae"
local_auth_validator.validate_previous_accommodation_postcode(record) local_auth_validator.validate_previous_accommodation_postcode(log)
expect(record.errors).to be_empty expect(log.errors).to be_empty
end end
it "does add an error when the postcode is invalid" do it "does add an error when the postcode is invalid" do
record.ppcodenk = 1 log.ppcodenk = 0
record.ppostcode_full = "invalid" log.ppostcode_full = "invalid"
local_auth_validator.validate_previous_accommodation_postcode(record) local_auth_validator.validate_previous_accommodation_postcode(log)
expect(record.errors).not_to be_empty expect(log.errors).not_to be_empty
expect(record.errors["ppostcode_full"]).to include(match I18n.t("validations.postcode")) expect(log.errors["ppostcode_full"]).to include(match I18n.t("validations.postcode"))
end end
end end
end end

4
spec/services/bulk_upload/lettings/log_creator_spec.rb

@ -67,7 +67,7 @@ RSpec.describe BulkUpload::Lettings::LogCreator do
waityear: 9, waityear: 9,
joint: 2, joint: 2,
tenancy: 9, tenancy: 9,
ppcodenk: 0, ppcodenk: 1,
) )
end end
@ -153,7 +153,7 @@ RSpec.describe BulkUpload::Lettings::LogCreator do
waityear: 9, waityear: 9,
joint: 2, joint: 2,
tenancy: 9, tenancy: 9,
ppcodenk: 0, ppcodenk: 1,
) )
end end

2
spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

@ -1562,7 +1562,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
let(:attributes) { { bulk_upload:, field_65: "2" } } let(:attributes) { { bulk_upload:, field_65: "2" } }
it "sets correct value from mapping" do it "sets correct value from mapping" do
expect(parser.log.ppcodenk).to eq(0) expect(parser.log.ppcodenk).to eq(1)
end end
end end

2
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -1642,7 +1642,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
let(:attributes) { { bulk_upload:, field_106: "2" } } let(:attributes) { { bulk_upload:, field_106: "2" } }
it "sets correct value from mapping" do it "sets correct value from mapping" do
expect(parser.log.ppcodenk).to eq(0) expect(parser.log.ppcodenk).to eq(1)
end end
end end

4
spec/services/bulk_upload/processor_spec.rb

@ -176,7 +176,7 @@ RSpec.describe BulkUpload::Processor do
waityear: 9, waityear: 9,
joint: 2, joint: 2,
tenancy: 9, tenancy: 9,
ppcodenk: 0, ppcodenk: 1,
voiddate: nil, voiddate: nil,
mrcdate: nil, mrcdate: nil,
startdate: Date.new(2022, 10, 1), startdate: Date.new(2022, 10, 1),
@ -385,7 +385,7 @@ RSpec.describe BulkUpload::Processor do
waityear: 9, waityear: 9,
joint: 2, joint: 2,
tenancy: 2, tenancy: 2,
ppcodenk: 0, ppcodenk: 1,
voiddate: Date.new(2022, 1, 1), voiddate: Date.new(2022, 1, 1),
reason: 40, reason: 40,
leftreg: 3, leftreg: 3,

Loading…
Cancel
Save