diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index aeccfc4cd..2448cba18 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -67,8 +67,7 @@ class BulkUpload tenancy: row[9], tenancyother: row[10], # tenancyduration: row[11], - other_hhmemb: other_hhmemb(row), - hhmemb: other_hhmemb(row) + 1, + hhmemb: hhmemb(row), age1: row[12], age2: row[13], age3: row[14], @@ -193,7 +192,7 @@ class BulkUpload illness_type_10: row[128], # london_affordable: row[129], rent_type: row[130], - intermediate_rent_product_name: row[131], + irproduct: row[131], # data_protection: row[132], sale_or_letting: "letting", declaration: 1, @@ -206,7 +205,7 @@ class BulkUpload Time.zone.local("20#{year}", month.to_s, day.to_s) end - def other_hhmemb(row) - [13, 14, 15, 16, 17, 18, 19].count { |idx| row[idx].present? } + def hhmemb(row) + [14, 15, 16, 17, 18, 19, 20].count { |idx| row[idx].present? } end end diff --git a/app/models/case_log.rb b/app/models/case_log.rb index aa926d5b4..2425e347f 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -51,6 +51,8 @@ class CaseLog < ApplicationRecord end def collection_start_year + return unless startdate + window_end_date = Time.zone.local(startdate.year, 4, 1) startdate < window_end_date ? startdate.year - 1 : startdate.year end @@ -364,20 +366,11 @@ private end def set_derived_fields! - if ppostcode_full.present? - self.ppostc1 = UKPostcode.parse(ppostcode_full).outcode - self.ppostc2 = UKPostcode.parse(ppostcode_full).incode - end if mrcdate.present? self.mrcday = mrcdate.day self.mrcmonth = mrcdate.month self.mrcyear = mrcdate.year end - if startdate.present? - self.day = startdate.day - self.month = startdate.month - self.year = startdate.year - end if property_void_date.present? self.vday = property_void_date.day self.vmonth = property_void_date.month @@ -387,7 +380,6 @@ private self.newprop = has_first_let_vacancy_reason? ? 1 : 2 end self.incref = 1 if net_income_refused? - self.other_hhmemb = hhmemb - 1 if hhmemb.present? self.renttype = RENT_TYPE_MAPPING[rent_type] self.lettype = get_lettype self.totchild = get_totchild @@ -416,11 +408,11 @@ private weekly_value(tshortfall) end self.nocharge = household_charge&.zero? ? 1 : 0 - self.underoccupation_benefitcap = 3 if renewal == 1 && year == 2021 + self.underoccupation_benefitcap = 3 if renewal == 1 && collection_start_year == 2021 self.ethnic = ethnic || ethnic_group self.housingneeds = get_housingneeds if is_renewal? - self.underoccupation_benefitcap = 2 if year == 2021 + self.underoccupation_benefitcap = 2 if collection_start_year == 2021 self.homeless = 2 self.referral = 0 self.layear = 1 @@ -447,7 +439,7 @@ private def process_previous_postcode_changes! self.ppostcode_full = ppostcode_full.present? ? ppostcode_full.upcase.gsub(/\s+/, "") : ppostcode_full - process_postcode(ppostcode_full, "previous_postcode_known", "is_previous_la_inferred", "prevloc", "ppostc1", "ppostc2") + process_postcode(ppostcode_full, "previous_postcode_known", "is_previous_la_inferred", "prevloc", nil, nil) end def process_postcode(postcode, postcode_known_key, la_inferred_key, la_key, outcode_key, incode_key) @@ -457,8 +449,8 @@ private inferred_la = get_inferred_la(postcode) self[la_inferred_key] = inferred_la.present? self[la_key] = inferred_la if inferred_la.present? - self[outcode_key] = UKPostcode.parse(postcode).outcode - self[incode_key] = UKPostcode.parse(postcode).incode + self[outcode_key] = UKPostcode.parse(postcode).outcode unless outcode_key.nil? + self[incode_key] = UKPostcode.parse(postcode).incode unless incode_key.nil? end def reset_location_fields! @@ -466,7 +458,7 @@ private end def reset_previous_location_fields! - reset_location(is_previous_la_inferred, "prevloc", "is_previous_la_inferred", "ppostcode_full", "ppostc1", "ppostc2", previous_la_known) + reset_location(is_previous_la_inferred, "prevloc", "is_previous_la_inferred", "ppostcode_full", nil, nil, previous_la_known) end def reset_location(is_inferred, la_key, is_inferred_key, postcode_key, incode_key, outcode_key, is_la_known) @@ -475,8 +467,8 @@ private end self[is_inferred_key] = false self[postcode_key] = nil - self[incode_key] = nil - self[outcode_key] = nil + self[incode_key] = nil unless incode_key.nil? + self[outcode_key] = nil unless outcode_key.nil? end def get_totelder diff --git a/app/models/validations/property_validations.rb b/app/models/validations/property_validations.rb index ab97a20d4..720cad20d 100644 --- a/app/models/validations/property_validations.rb +++ b/app/models/validations/property_validations.rb @@ -112,7 +112,7 @@ module Validations::PropertyValidations record.errors.add :beds, I18n.t("validations.property.unittype_gn.one_bedroom_bedsit") end - if record.other_hhmemb&.zero? && record.is_shared_housing? && + if record.hhmemb == 1 && record.is_shared_housing? && !record.beds.to_i.between?(1, 3) && record.beds.present? record.errors.add :unittype_gn, I18n.t("validations.property.unittype_gn.one_three_bedroom_single_tenant_shared") record.errors.add :beds, I18n.t("validations.property.unittype_gn.one_three_bedroom_single_tenant_shared") diff --git a/app/models/validations/setup_validations.rb b/app/models/validations/setup_validations.rb index 927a32de9..44770c947 100644 --- a/app/models/validations/setup_validations.rb +++ b/app/models/validations/setup_validations.rb @@ -1,7 +1,7 @@ module Validations::SetupValidations - def validate_intermediate_rent_product_name(record) - if intermediate_product_rent_type?(record) && record.intermediate_rent_product_name.blank? - record.errors.add :intermediate_rent_product_name, I18n.t("validations.setup.intermediate_rent_product_name.blank") + def validate_irproduct_other(record) + if intermediate_product_rent_type?(record) && record.irproduct_other.blank? + record.errors.add :irproduct_other, I18n.t("validations.setup.intermediate_rent_product_name.blank") end end diff --git a/app/services/imports/case_logs_import_service.rb b/app/services/imports/case_logs_import_service.rb new file mode 100644 index 000000000..6a4d9e655 --- /dev/null +++ b/app/services/imports/case_logs_import_service.rb @@ -0,0 +1,278 @@ +module Imports + class CaseLogsImportService < ImportService + def create_logs(folder) + import_from(folder, :create_log) + end + + private + + GN_SH = { + general_needs: 1, + supported_housing: 2, + }.freeze + + SR_AR_IR = { + social_rent: 1, + affordable_rent: 2, + intermediate_rent: 3, + }.freeze + + # For providertype, values are reversed!!! + PRP_LA = { + private_registered_provider: 1, + local_authority: 2, + }.freeze + + IRPRODUCT = { + rent_to_buy: 1, + london_living_rent: 2, + other_intermediate_rent_product: 3, + }.freeze + + # These must match our form + RENT_TYPE = { + social_rent: 0, + affordable_rent: 1, + london_affordable_rent: 2, + rent_to_buy: 3, + london_living_rent: 4, + other_intermediate_rent_product: 5, + }.freeze + + # Order matters since we derive from previous values (uses attributes) + def create_log(xml_doc) + attributes = {} + + # Required fields for status complete or logic to work + attributes["startdate"] = start_date(xml_doc) + attributes["owning_organisation_id"] = find_organisation_id(xml_doc, "OWNINGORGID") + attributes["managing_organisation_id"] = find_organisation_id(xml_doc, "MANINGORGID") + attributes["previous_postcode_known"] = previous_postcode_known(xml_doc) + attributes["ppostcode_full"] = previous_postcode(xml_doc, attributes) + attributes["needstype"] = needs_type(xml_doc) + attributes["lar"] = london_affordable_rent(xml_doc) + attributes["irproduct"] = unsafe_string_as_integer(xml_doc, "IRPRODUCT") + attributes["irproduct_other"] = field_value(xml_doc, "xmlns", "IRPRODUCTOTHER") + attributes["rent_type"] = rent_type(xml_doc, attributes) + attributes["rsnvac"] = unsafe_string_as_integer(xml_doc, "Q27") + attributes["renewal"] = renewal(attributes) + (1..8).each do |index| + attributes["age#{index}"] = age(xml_doc, index) + attributes["sex#{index}"] = sex(xml_doc, index) + attributes["ecstat#{index}"] = unsafe_string_as_integer(xml_doc, "P#{index}Eco") + end + # attributes["hhmemb"] = + + # Not specific to our form but required for CDS and can't be inferred + # attributes["form"] = Integer(field_value(xml_doc, "xmlns", "FORM")) + # attributes["lettype"] = let_type(xml_doc, attributes) + + case_log = CaseLog.new(attributes) + case_log.save! + + # pp attributes + # pp case_log.status + # pp case_log.send(:mandatory_fields) + end + + def start_date(xml_doc) + day = Integer(field_value(xml_doc, "xmlns", "DAY")) + month = Integer(field_value(xml_doc, "xmlns", "MONTH")) + year = Integer(field_value(xml_doc, "xmlns", "YEAR")) + Date.new(year, month, day) + end + + def get_form_name_component(xml_doc, index) + form_name = field_value(xml_doc, "meta", "form-name") + form_type_components = form_name.split("-") + form_type_components[index] + end + + def needs_type(xml_doc) + gn_sh = get_form_name_component(xml_doc, -1) + case gn_sh + when "GN" + GN_SH[:general_needs] + when "SH" + GN_SH[:supported_housing] + else + raise "Unknown needstype value: #{gn_sh}" + end + end + + # This does not match renttype (CDS) which is derived by case logs logic + def rent_type(xml_doc, attributes) + sr_ar_ir = get_form_name_component(xml_doc, -2) + + case sr_ar_ir + when "SR" + RENT_TYPE[:social_rent] + when "AR" + if attributes["lar"] == 1 + RENT_TYPE[:london_affordable_rent] + else + RENT_TYPE[:affordable_rent] + end + when "IR" + if attributes["irproduct"] == IRPRODUCT[:rent_to_buy] + RENT_TYPE[:rent_to_buy] + elsif attributes["irproduct"] == IRPRODUCT[:london_living_rent] + RENT_TYPE[:london_living_rent] + elsif attributes["irproduct"] == IRPRODUCT[:other_intermediate_rent_product] + RENT_TYPE[:other_intermediate_rent_product] + end + end + end + + # def let_type(xml_doc, attributes) + # # "1 Private Registered Provider" or "2 Local Authority" + # # We do not store providertype since it comes from the organisation import + # landlord = field_value(xml_doc, "xmlns", "Landlord").to_i + # + # if attributes["renttype"] == SR_AR_IR[:social_rent] && + # attributes["needstype"] == GN_SH[:general_needs] && + # landlord == PRP_LA[:private_registered_provider] + # 1 + # elsif attributes["renttype"] == SR_AR_IR[:social_rent] && + # attributes["needstype"] == GN_SH[:supported_housing] && + # landlord == PRP_LA[:private_registered_provider] + # 2 + # elsif attributes["renttype"] == SR_AR_IR[:social_rent] && + # attributes["needstype"] == GN_SH[:general_needs] && + # landlord == PRP_LA[:local_authority] + # 3 + # elsif attributes["renttype"] == SR_AR_IR[:social_rent] && + # attributes["needstype"] == GN_SH[:supported_housing] && + # landlord == PRP_LA[:local_authority] + # 4 + # elsif attributes["renttype"] == SR_AR_IR[:affordable_rent] && + # attributes["needstype"] == GN_SH[:general_needs] && + # landlord == PRP_LA[:private_registered_provider] + # 5 + # elsif attributes["renttype"] == SR_AR_IR[:affordable_rent] && + # attributes["needstype"] == GN_SH[:supported_housing] && + # landlord == PRP_LA[:private_registered_provider] + # 6 + # elsif attributes["renttype"] == SR_AR_IR[:affordable_rent] && + # attributes["needstype"] == GN_SH[:general_needs] && + # landlord == PRP_LA[:local_authority] + # 7 + # elsif attributes["renttype"] == SR_AR_IR[:affordable_rent] && + # attributes["needstype"] == GN_SH[:supported_housing] && + # landlord == PRP_LA[:local_authority] + # 8 + # elsif attributes["renttype"] == SR_AR_IR[:intermediate_rent] && + # attributes["needstype"] == GN_SH[:general_needs] && + # landlord == PRP_LA[:private_registered_provider] + # 9 + # elsif attributes["renttype"] == SR_AR_IR[:intermediate_rent] && + # attributes["needstype"] == GN_SH[:supported_housing] && + # landlord == PRP_LA[:private_registered_provider] + # 10 + # elsif attributes["renttype"] == SR_AR_IR[:intermediate_rent] && + # attributes["needstype"] == GN_SH[:general_needs] && + # landlord == PRP_LA[:local_authority] + # 11 + # elsif attributes["renttype"] == SR_AR_IR[:intermediate_rent] && + # attributes["needstype"] == GN_SH[:supported_housing] && + # landlord == PRP_LA[:local_authority] + # 12 + # else + # raise "Could not infer rent type with rentype:#{attributes['renttype']} / needstype:#{attributes['needstype']} / landlord:#{landlord}" + # end + # end + + def find_organisation_id(xml_doc, field) + old_visible_id = field_value(xml_doc, "xmlns", field).to_i + landlord = field_value(xml_doc, "xmlns", "Landlord").to_i + + organisation = Organisation.find_by(old_visible_id:) + # Quick hack: should be removed when all organisations are imported + # Will fail in the future if the organisation is missing + if organisation.nil? + organisation = Organisation.new + organisation.old_visible_id = old_visible_id + organisation.provider_type = if landlord == 2 + 1 + else + 2 + end + organisation.save! + end + organisation.id + end + + def age(xml_doc, index) + Integer(field_value(xml_doc, "xmlns", "P#{index}Age"), exception: false) + end + + def sex(xml_doc, index) + sex = field_value(xml_doc, "xmlns", "P#{index}Sex") + case sex + when "Male" + "M" + when "Female" + "F" + when "Other", "Non-binary" + "X" + when "Refused" + "R" + end + end + + def previous_postcode_known(xml_doc) + previous_postcode_known = field_value(xml_doc, "xmlns", "Q12bnot") + if previous_postcode_known == "Temporary or Unknown" + 0 + else + 1 + end + end + + def previous_postcode(xml_doc, attributes) + previous_postcode_known = attributes["previous_postcode_known"] + if previous_postcode_known.zero? + nil + else + outcode = field_value(xml_doc, "xmlns", "PPOSTC1") + incode = field_value(xml_doc, "xmlns", "PPOSTC2") + "#{outcode} #{incode}" + end + end + + def london_affordable_rent(xml_doc) + lar = unsafe_string_as_integer(xml_doc, "LAR") + if lar == 1 + 1 + else + # We default to No for any other values (nil, not known) + 2 + end + end + + def renewal(attributes) + # Relet – renewal of fixed-term tenancy + if attributes["rsnvac"] == 14 + 1 + else + 0 + end + end + + # Safe: A string that represents only an integer (or empty/nil) + def safe_string_as_integer(xml_doc, attribute) + str = field_value(xml_doc, "xmlns", attribute) + Integer(str, exception: false) + end + + # Unsafe: A string that has more than just the integer value + def unsafe_string_as_integer(xml_doc, attribute) + str = field_value(xml_doc, "xmlns", attribute) + if str.blank? + nil + else + str.to_i + end + end + end +end diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 0b92bf3b2..2b4ce0bfc 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1559,25 +1559,25 @@ }, "depends_on": [ { - "other_hhmemb": 1 + "hhmemb": 2 }, { - "other_hhmemb": 2 + "hhmemb": 3 }, { - "other_hhmemb": 3 + "hhmemb": 4 }, { - "other_hhmemb": 4 + "hhmemb": 5 }, { - "other_hhmemb": 5 + "hhmemb": 6 }, { - "other_hhmemb": 6 + "hhmemb": 7 }, { - "other_hhmemb": 7 + "hhmemb": 8 } ] }, @@ -1772,22 +1772,22 @@ }, "depends_on": [ { - "other_hhmemb": 2 + "hhmemb": 3 }, { - "other_hhmemb": 3 + "hhmemb": 4 }, { - "other_hhmemb": 4 + "hhmemb": 5 }, { - "other_hhmemb": 5 + "hhmemb": 6 }, { - "other_hhmemb": 6 + "hhmemb": 7 }, { - "other_hhmemb": 7 + "hhmemb": 8 } ] }, @@ -1982,19 +1982,19 @@ }, "depends_on": [ { - "other_hhmemb": 3 + "hhmemb": 4 }, { - "other_hhmemb": 4 + "hhmemb": 5 }, { - "other_hhmemb": 5 + "hhmemb": 6 }, { - "other_hhmemb": 6 + "hhmemb": 7 }, { - "other_hhmemb": 7 + "hhmemb": 8 } ] }, @@ -2189,16 +2189,16 @@ }, "depends_on": [ { - "other_hhmemb": 4 + "hhmemb": 5 }, { - "other_hhmemb": 5 + "hhmemb": 6 }, { - "other_hhmemb": 6 + "hhmemb": 7 }, { - "other_hhmemb": 7 + "hhmemb": 8 } ] }, @@ -2393,13 +2393,13 @@ }, "depends_on": [ { - "other_hhmemb": 5 + "hhmemb": 6 }, { - "other_hhmemb": 6 + "hhmemb": 7 }, { - "other_hhmemb": 7 + "hhmemb": 8 } ] }, @@ -2594,10 +2594,10 @@ }, "depends_on": [ { - "other_hhmemb": 6 + "hhmemb": 7 }, { - "other_hhmemb": 7 + "hhmemb": 8 } ] }, @@ -2792,7 +2792,7 @@ }, "depends_on": [ { - "other_hhmemb": 7 + "hhmemb": 8 } ] }, diff --git a/db/migrate/202202071123100_additional_user_fields2.rb b/db/migrate/20220207112310_additional_user_fields2.rb similarity index 100% rename from db/migrate/202202071123100_additional_user_fields2.rb rename to db/migrate/20220207112310_additional_user_fields2.rb diff --git a/db/migrate/20220411092231_update_case_logs_fields.rb b/db/migrate/20220411092231_update_case_logs_fields.rb new file mode 100644 index 000000000..dedcd9339 --- /dev/null +++ b/db/migrate/20220411092231_update_case_logs_fields.rb @@ -0,0 +1,10 @@ +class UpdateCaseLogsFields < ActiveRecord::Migration[7.0] + def change + change_table :case_logs, bulk: true do |t| + t.integer :form, :lar, :irproduct + t.remove :day, :month, :year, :other_hhmemb, type: :integer + t.remove :ppostc1, :ppostc2, type: :string + t.rename :intermediate_rent_product_name, :irproduct_other + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 61368691c..24ef70b2a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 202202071123100) do +ActiveRecord::Schema[7.0].define(version: 2022_04_11_092231) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -132,7 +132,7 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do t.string "property_owner_organisation" t.string "property_manager_organisation" t.string "sale_or_letting" - t.string "intermediate_rent_product_name" + t.string "irproduct_other" t.string "purchaser_code" t.integer "reason" t.string "propcode" @@ -143,14 +143,11 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do t.integer "hbrentshortfall" t.string "postcode" t.string "postcod2" - t.string "ppostc1" - t.string "ppostc2" t.integer "property_relet" t.datetime "mrcdate", precision: nil t.integer "mrcday" t.integer "mrcmonth" t.integer "mrcyear" - t.integer "other_hhmemb" t.integer "incref" t.datetime "sale_completion_date", precision: nil t.datetime "startdate", precision: nil @@ -167,9 +164,6 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do t.integer "postcode_known" t.integer "la_known" t.boolean "is_la_inferred" - t.integer "day" - t.integer "month" - t.integer "year" t.integer "totchild" t.integer "totelder" t.integer "totadult" @@ -232,6 +226,9 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do t.string "relat7" t.string "relat8" t.integer "rent_value_check" + t.integer "form" + t.integer "lar" + t.integer "irproduct" t.index ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id" end @@ -318,12 +315,12 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do t.string "last_sign_in_ip" t.integer "role" t.string "old_user_id" + t.string "phone" t.integer "failed_attempts", default: 0 t.string "unlock_token" t.datetime "locked_at", precision: nil t.boolean "is_dpo", default: false t.boolean "is_key_contact", default: false - t.string "phone" t.integer "second_factor_attempts_count", default: 0 t.string "encrypted_otp_secret_key" t.string "encrypted_otp_secret_key_iv" diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb index 2bec19c48..4f27af26c 100644 --- a/spec/factories/case_log.rb +++ b/spec/factories/case_log.rb @@ -7,7 +7,6 @@ FactoryBot.define do needstype { 1 } rent_type { 1 } startdate { Time.zone.local(2022, 5, 1) } - year { 2022 } end trait :in_progress do status { 1 } @@ -30,7 +29,7 @@ FactoryBot.define do ethnic { 2 } national { 4 } ecstat1 { 2 } - other_hhmemb { 0 } + hhmemb { 1 } end trait :completed do status { 2 } @@ -42,7 +41,6 @@ FactoryBot.define do national { 4 } prevten { 6 } ecstat1 { 0 } - other_hhmemb { 1 } hhmemb { 2 } relat2 { "P" } age2 { 32 } @@ -115,7 +113,6 @@ FactoryBot.define do property_manager_organisation { "Test" } renewal { 0 } rent_type { 1 } - intermediate_rent_product_name { 2 } needstype { 1 } purchaser_code { 798_794 } reason { 4 } @@ -127,8 +124,6 @@ FactoryBot.define do hbrentshortfall { 0 } tshortfall { 12 } postcod2 { "w3" } - ppostc1 { "w3" } - ppostc2 { "w3" } property_relet { 0 } mrcdate { Time.utc(2020, 5, 0o5, 10, 36, 49) } mrcday { mrcdate.day } @@ -137,9 +132,6 @@ FactoryBot.define do incref { 0 } sale_completion_date { nil } startdate { Time.utc(2022, 2, 2, 10, 36, 49) } - day { startdate.day } - month { startdate.month } - year { startdate.year } armedforces { 0 } builtype { 1 } unitletas { 2 } diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb index 34125ee41..9cdd19e78 100644 --- a/spec/features/form/check_answers_page_spec.rb +++ b/spec/features/form/check_answers_page_spec.rb @@ -53,7 +53,7 @@ RSpec.describe "Form Check Answers Page" do it "has question headings based on the subsection" do visit("/logs/#{id}/#{subsection}/check-answers") - question_labels = ["Tenant code", "Lead tenant’s age", "Lead tenant’s gender identity", "Number of Other Household Members"] + question_labels = ["Tenant code", "Lead tenant’s age", "Lead tenant’s gender identity", "Number of Household Members"] question_labels.each do |label| expect(page).to have_content(label) end @@ -151,7 +151,7 @@ RSpec.describe "Form Check Answers Page" do tenant_code: "123", age1: 35, sex1: "M", - other_hhmemb: 0, + hhmemb: 1, ) end @@ -164,7 +164,7 @@ RSpec.describe "Form Check Answers Page" do tenant_code: "123", age1: 35, sex1: "M", - other_hhmemb: 0, + hhmemb: 1, armedforces: 3, illness: 0, ) @@ -179,7 +179,7 @@ RSpec.describe "Form Check Answers Page" do tenant_code: "123", age1: 35, sex1: "M", - other_hhmemb: 0, + hhmemb: 1, armedforces: 3, illness: 0, housingneeds_h: 1, diff --git a/spec/features/form/form_navigation_spec.rb b/spec/features/form/form_navigation_spec.rb index fd4f78b08..f62789680 100644 --- a/spec/features/form/form_navigation_spec.rb +++ b/spec/features/form/form_navigation_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "Form Navigation" do age1: { type: "numeric", answer: 25, path: "person-1-age" }, sex1: { type: "radio", answer: "Female", path: "person-1-gender" }, ecstat1: { type: "radio", answer: 3, path: "person-1-working-situation" }, - other_hhmemb: { type: "numeric", answer: 2, path: "household-number-of-other-members" }, + hhmemb: { type: "numeric", answer: 1, path: "household-number-of-members" }, } end diff --git a/spec/features/form/saving_data_spec.rb b/spec/features/form/saving_data_spec.rb index d9fa2feba..9e8d09f58 100644 --- a/spec/features/form/saving_data_spec.rb +++ b/spec/features/form/saving_data_spec.rb @@ -26,7 +26,7 @@ RSpec.describe "Form Saving Data" do tenant_code: { type: "text", answer: "BZ737", path: "tenant_code" }, age1: { type: "numeric", answer: 25, path: "person_1_age" }, sex1: { type: "radio", answer: { "F" => "Female" }, path: "person_1_gender" }, - other_hhmemb: { type: "numeric", answer: 2, path: "household_number_of_other_members" }, + hhmemb: { type: "numeric", answer: 3, path: "household_number_of_members" }, } end diff --git a/spec/fixtures/exports/case_logs.xml b/spec/fixtures/exports/case_logs.xml index 6ad128d05..3b01438c6 100644 --- a/spec/fixtures/exports/case_logs.xml +++ b/spec/fixtures/exports/case_logs.xml @@ -90,7 +90,7 @@ Test Test - 2 + 798794 4 123 @@ -101,14 +101,11 @@ 0 NW1 5TY - SE2 - 6RT 0 2020-05-05 10:36:49 UTC 5 5 2020 - 1 0 2022-02-02 10:36:49 UTC @@ -125,9 +122,6 @@ 1 1 false - 2 - 2 - 2022 0 0 2 @@ -174,6 +168,9 @@ +
+ + 1 diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index e458d4215..16a9efbf7 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -114,21 +114,21 @@ } } }, - "household_number_of_other_members": { + "household_number_of_members": { "questions": { - "other_hhmemb": { - "check_answer_label": "Number of Other Household Members", - "header": "How many other people are there in the household?", - "hint_text": "The maximum number of others is 1", + "hhmemb": { + "check_answer_label": "Number of Household Members", + "header": "How many people are there in the household?", + "hint_text": "The maximum number of members is 8", "type": "numeric", "min": 0, - "max": 7, + "max": 8, "step": 1, "width": 2, "conditional_for": { - "relat2": ">0", - "age2": ">0", - "sex2": ">0" + "relat2": ">1", + "age2": ">1", + "sex2": ">1" } }, "relat2": { diff --git a/spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml b/spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml new file mode 100644 index 000000000..34ccc8e12 --- /dev/null +++ b/spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml @@ -0,0 +1,532 @@ + + + + 2021-CORE-SR-GN + 0ead17cb-1668-442d-898c-0d52879ff592 + c3061a2e6ea0b702e6f6210d5c52d2a92612d2aa + + 7c5bd5fb549c09a2c55d7cb90d7ba84927e64618 + + 7c5bd5fb549c09a2c55d7cb90d7ba84927e64618 + + 2021-10-08T14:48:17.096123Z + 2021-10-08T14:48:17.096123Z + submitted-valid + 2021 + Manual Entry + + + + + Yes + 2021-09-30 +
5786509
+ 1 Private Registered Provider + + <_1btenagree>1 This Landlord + <_1bifanother/> + <_1bCOREcode/> + +
+ + <_2a>1 Yes + 2 Assured + + <_2bTenCode>MAC003 + <_2cYears/> + + + 23 + + Female + 6) Not Seeking Work + 1 White: English/Scottish/Welsh/Northern Irish/British + 1 UK national resident in UK + 2 + + Male + Child + 9) Child under 16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 No + + + 2 No + + + 6 UC – with housing element (and not in receipt of Housing + Benefit) + + + + 1 All + + 600.00 + 2 Monthly + + + 12 Property unsuitable because of overcrowding + + + + <_9b override-field="">2 No + + + + + Yes + + 2 No + + + + + + + + + + + 30 Fixed term Local Authority General Needs + tenancy + + Leeds + E08000035 + LS8 3HX + + 5 5 years or more + 2 Less than 1 year + + + 1 Not homeless + 1 Yes + + 2_Living_in_insanitary_or_overcrowded_or_unsatisfactory_housing + + + + + + + 1 Yes + 2 No + 2 No + + + 3 PRP lettings only - nominated by a local housing authority + + + + 4 Calendar monthly + 406.09 + 32.02 + + + 438.11 + 2 No + + 2021-09-30 + + 0 + MCB003 + + + 2 + 1 Flat / maisonette + 1 Purpose built + 2 No + + 15 First let of newbuild property + + + Leeds + E08000035 + LS16 6FT + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + <_100>0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + <_70>0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 23 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 23 + 21 + 23 + 2021-10-08Z + 2021-10-23Z + + + + + + + + + + + + + 0 + 0 + 0 + 0 + 20 + 0 + 20 + C + 1 + 1 + 1 + 1 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 21.05 + 1 + 2 Existing Tenant + 1 + 1 + 0 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 5 = 1 adult + 1 or more children + 133.33 + 154.38 + 7.00 + + 154.38 + 1 Private Registered Provider + + + E12000003 + 1034 + LEEDS & YORKSHIRE HA Ltd + LEEDS & YORKSHIRE HA Ltd + LH0704 + LH0704 + + 1034 + + + + + + + 7 + + + + + + + + + 7 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 93.71 + 101.10 + 7.39 + + + + + + 93.71 + 101.10 + 7.39 + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0.5 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 2 + 0 + 93.71 + 0 + + 68.6 + 74.7 + 25 + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 30 + 9 + 2021 + 30 + 9 + 2021 + + + + LS8 + 3HX + LS16 + 6FT + +
diff --git a/spec/helpers/check_answers_helper_spec.rb b/spec/helpers/check_answers_helper_spec.rb index c0642db81..8c7b4e69d 100644 --- a/spec/helpers/check_answers_helper_spec.rb +++ b/spec/helpers/check_answers_helper_spec.rb @@ -16,7 +16,7 @@ RSpec.describe CheckAnswersHelper do context "when a section has been completed" do it "returns that you have answered all the questions" do case_log.sex1 = "F" - case_log.other_hhmemb = 0 + case_log.hhmemb = 1 case_log.propcode = "123" case_log.ecstat1 = 200 case_log.ecstat2 = 9 diff --git a/spec/models/case_log_spec.rb b/spec/models/case_log_spec.rb index b648f27f2..ee62fbd2b 100644 --- a/spec/models/case_log_spec.rb +++ b/spec/models/case_log_spec.rb @@ -57,7 +57,7 @@ RSpec.describe CaseLog do end it "validates intermediate rent product name" do - expect(validator).to receive(:validate_intermediate_rent_product_name) + expect(validator).to receive(:validate_irproduct_other) end it "validates other household member details" do @@ -216,12 +216,6 @@ RSpec.describe CaseLog do expect(record_from_db["postcod2"]).to eq("1AE") end - it "correctly derives and saves partial and full previous postcodes" do - record_from_db = ActiveRecord::Base.connection.execute("select ppostc1, ppostc2 from case_logs where id=#{case_log.id}").to_a[0] - expect(record_from_db["ppostc1"]).to eq("M2") - expect(record_from_db["ppostc2"]).to eq("2AE") - end - it "correctly derives and saves partial and full major repairs date" do record_from_db = ActiveRecord::Base.connection.execute("select mrcday, mrcmonth, mrcyear, mrcdate from case_logs where id=#{case_log.id}").to_a[0] expect(record_from_db["mrcdate"].day).to eq(4) @@ -247,11 +241,6 @@ RSpec.describe CaseLog do expect(record_from_db["incref"]).to eq(1) end - it "correctly derives and saves other_hhmemb" do - record_from_db = ActiveRecord::Base.connection.execute("select other_hhmemb from case_logs where id=#{case_log.id}").to_a[0] - expect(record_from_db["other_hhmemb"]).to eq(6) - end - it "correctly derives and saves renttype" do record_from_db = ActiveRecord::Base.connection.execute("select renttype from case_logs where id=#{case_log.id}").to_a[0] expect(case_log.renttype).to eq(3) @@ -1131,13 +1120,10 @@ RSpec.describe CaseLog do end it "correctly derives and saves day, month, year from start date" do - record_from_db = ActiveRecord::Base.connection.execute("select day, month, year, startdate from case_logs where id=#{case_log.id}").to_a[0] + record_from_db = ActiveRecord::Base.connection.execute("select startdate from case_logs where id=#{case_log.id}").to_a[0] expect(record_from_db["startdate"].day).to eq(10) expect(record_from_db["startdate"].month).to eq(10) expect(record_from_db["startdate"].year).to eq(2021) - expect(record_from_db["day"]).to eq(10) - expect(record_from_db["month"]).to eq(10) - expect(record_from_db["year"]).to eq(2021) end context "when any charge field is set" do @@ -1161,6 +1147,11 @@ RSpec.describe CaseLog do expect(address_case_log[incode_field]).to eq("1AE") expect(record_from_db[incode_field]).to eq("1AE") end + def check_previous_postcode_fields(postcode_field) + record_from_db = ActiveRecord::Base.connection.execute("select #{postcode_field} from case_logs where id=#{address_case_log.id}").to_a[0] + expect(address_case_log[postcode_field]).to eq("M11AE") + expect(record_from_db[postcode_field]).to eq("M11AE") + end context "when saving addresses" do before do stub_request(:get, /api.postcodes.io/) @@ -1263,22 +1254,22 @@ RSpec.describe CaseLog do }) end - def check_previous_postcode_fields - check_postcode_fields("ppostcode_full", "ppostc1", "ppostc2") + def previous_postcode_fields + check_previous_postcode_fields("ppostcode_full") end it "correctly formats previous postcode" do address_case_log.update!(ppostcode_full: "M1 1AE") - check_previous_postcode_fields + previous_postcode_fields address_case_log.update!(ppostcode_full: "m1 1ae") - check_previous_postcode_fields + previous_postcode_fields address_case_log.update!(ppostcode_full: "m11Ae") - check_previous_postcode_fields + previous_postcode_fields address_case_log.update!(ppostcode_full: "m11ae") - check_previous_postcode_fields + previous_postcode_fields end it "correctly infers prevloc" do @@ -1360,7 +1351,7 @@ RSpec.describe CaseLog do described_class.create!({ managing_organisation: organisation, owning_organisation: organisation, - other_hhmemb: 4, + hhmemb: 3, relat2: "X", relat3: "C", relat4: "X", @@ -1414,7 +1405,7 @@ RSpec.describe CaseLog do managing_organisation: organisation, owning_organisation: organisation, renewal: 1, - year: 2021, + startdate: Time.zone.local(2021, 4, 10), }) end diff --git a/spec/models/form/subsection_spec.rb b/spec/models/form/subsection_spec.rb index 1cd11eb7f..3ff5e6f3e 100644 --- a/spec/models/form/subsection_spec.rb +++ b/spec/models/form/subsection_spec.rb @@ -25,12 +25,12 @@ RSpec.describe Form::Subsection, type: :model do end it "has pages" do - expected_pages = %w[tenant_code person_1_age person_1_gender person_1_working_situation household_number_of_other_members person_2_working_situation propcode] + expected_pages = %w[tenant_code person_1_age person_1_gender person_1_working_situation household_number_of_members person_2_working_situation propcode] expect(subsection.pages.map(&:id)).to eq(expected_pages) end it "has questions" do - expected_questions = %w[tenant_code age1 sex1 ecstat1 other_hhmemb relat2 age2 sex2 ecstat2 propcode] + expected_questions = %w[tenant_code age1 sex1 ecstat1 hhmemb relat2 age2 sex2 ecstat2 propcode] expect(subsection.questions.map(&:id)).to eq(expected_questions) end @@ -58,7 +58,7 @@ RSpec.describe Form::Subsection, type: :model do end it "has question helpers for the number of applicable questions" do - expected_questions = %w[tenant_code age1 sex1 ecstat1 other_hhmemb ecstat2 propcode] + expected_questions = %w[tenant_code age1 sex1 ecstat1 hhmemb ecstat2 propcode] expect(subsection.applicable_questions(case_log).map(&:id)).to eq(expected_questions) expect(subsection.applicable_questions_count(case_log)).to eq(7) end @@ -79,7 +79,7 @@ RSpec.describe Form::Subsection, type: :model do end it "has a question helpers for the unanswered questions" do - expected_questions = %w[sex1 ecstat1 other_hhmemb ecstat2 propcode] + expected_questions = %w[sex1 ecstat1 hhmemb ecstat2 propcode] expect(subsection.unanswered_questions(case_log).map(&:id)).to eq(expected_questions) end end diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index d9c8b5ee9..d5201a1d3 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -130,7 +130,7 @@ RSpec.describe Form, type: :model do case_log.age1 = 35 case_log.sex1 = "M" case_log.ecstat1 = 0 - case_log.other_hhmemb = 1 + case_log.hhmemb = 2 case_log.relat2 = "P" case_log.sex2 = "F" case_log.ecstat2 = 1 diff --git a/spec/models/validations/financial_validations_spec.rb b/spec/models/validations/financial_validations_spec.rb index 7582190a3..59299e62a 100644 --- a/spec/models/validations/financial_validations_spec.rb +++ b/spec/models/validations/financial_validations_spec.rb @@ -757,7 +757,6 @@ RSpec.describe Validations::FinancialValidations do record.period = 1 record.la = "E07000223" record.beds = 1 - record.year = 2021 record.startdate = Time.zone.local(2021, 9, 17) record.brent = 9.17 @@ -772,7 +771,6 @@ RSpec.describe Validations::FinancialValidations do record.la = "E07000223" record.beds = 1 record.startdate = Time.zone.local(2021, 9, 17) - record.year = 2021 record.brent = 200 financial_validator.validate_rent_amount(record) @@ -794,9 +792,6 @@ RSpec.describe Validations::FinancialValidations do record.la = "E07000223" record.startdate = Time.zone.local(2022, 2, 5) record.beds = 1 - record.year = 2022 - record.month = 2 - record.day = 5 record.brent = 200 financial_validator.validate_rent_amount(record) @@ -814,7 +809,6 @@ RSpec.describe Validations::FinancialValidations do it "does not error if some of the fields are missing" do record.managing_organisation.provider_type = 2 - record.year = 2021 record.startdate = Time.zone.local(2021, 9, 17) record.brent = 200 diff --git a/spec/models/validations/household_validations_spec.rb b/spec/models/validations/household_validations_spec.rb index 36edd3f12..6b57cc790 100644 --- a/spec/models/validations/household_validations_spec.rb +++ b/spec/models/validations/household_validations_spec.rb @@ -462,24 +462,24 @@ RSpec.describe Validations::HouseholdValidations do expect(record.errors["age2"]).to be_empty end - it "validates that the number of other household members cannot be less than 0" do - record.other_hhmemb = -1 + it "validates that the number of household members cannot be less than 0" do + record.hhmemb = -1 household_validator.validate_numeric_min_max(record) - expect(record.errors["other_hhmemb"]) - .to include(match I18n.t("validations.numeric.valid", field: "Number of Other Household Members", min: 0, max: 7)) + expect(record.errors["hhmemb"]) + .to include(match I18n.t("validations.numeric.valid", field: "Number of Household Members", min: 0, max: 8)) end - it "validates that the number of other household members cannot be more than 7" do - record.other_hhmemb = 8 + it "validates that the number of household members cannot be more than 8" do + record.hhmemb = 9 household_validator.validate_numeric_min_max(record) - expect(record.errors["other_hhmemb"]) - .to include(match I18n.t("validations.numeric.valid", field: "Number of Other Household Members", min: 0, max: 7)) + expect(record.errors["hhmemb"]) + .to include(match I18n.t("validations.numeric.valid", field: "Number of Household Members", min: 0, max: 8)) end it "expects that the number of other household members is between the min and max" do - record.other_hhmemb = 5 + record.hhmemb = 5 household_validator.validate_numeric_min_max(record) - expect(record.errors["other_hhmemb"]).to be_empty + expect(record.errors["hhmemb"]).to be_empty end end diff --git a/spec/models/validations/property_validations_spec.rb b/spec/models/validations/property_validations_spec.rb index 5dd339984..d2c34a613 100644 --- a/spec/models/validations/property_validations_spec.rb +++ b/spec/models/validations/property_validations_spec.rb @@ -97,7 +97,7 @@ RSpec.describe Validations::PropertyValidations do it "adds an error if the number of bedrooms is not between 1 and 7" do record.beds = 8 record.unittype_gn = 5 - record.other_hhmemb = 2 + record.hhmemb = 3 property_validator.validate_shared_housing_rooms(record) expect(record.errors["unittype_gn"]).to include(match(expected_error)) expect(record.errors["beds"]).to include(I18n.t("validations.property.unittype_gn.one_seven_bedroom_shared")) @@ -110,7 +110,7 @@ RSpec.describe Validations::PropertyValidations do it "adds an error if the number of bedrooms is not between 1 and 7" do record.beds = 0 record.unittype_gn = 5 - record.other_hhmemb = 2 + record.hhmemb = 3 property_validator.validate_shared_housing_rooms(record) expect(record.errors["unittype_gn"]).to include(match(expected_error)) expect(record.errors["beds"]).to include(I18n.t("validations.property.unittype_gn.one_seven_bedroom_shared")) @@ -123,7 +123,7 @@ RSpec.describe Validations::PropertyValidations do it "adds an error" do record.beds = 4 record.unittype_gn = 5 - record.other_hhmemb = 0 + record.hhmemb = 1 property_validator.validate_shared_housing_rooms(record) expect(record.errors["unittype_gn"]).to include(match(expected_error)) expect(record.errors["beds"]).to include(I18n.t("validations.property.unittype_gn.one_three_bedroom_single_tenant_shared")) diff --git a/spec/models/validations/setup_validations_spec.rb b/spec/models/validations/setup_validations_spec.rb index 0c333d6d7..56b335464 100644 --- a/spec/models/validations/setup_validations_spec.rb +++ b/spec/models/validations/setup_validations_spec.rb @@ -6,28 +6,28 @@ RSpec.describe Validations::SetupValidations do let(:setup_validator_class) { Class.new { include Validations::SetupValidations } } let(:record) { FactoryBot.create(:case_log) } - describe "#validate_intermediate_rent_product_name" do + describe "#validate_irproduct" do it "adds an error when the intermediate rent product name is not provided but the rent type was given as other intermediate rent product" do record.rent_type = 5 - record.intermediate_rent_product_name = nil - setup_validator.validate_intermediate_rent_product_name(record) - expect(record.errors["intermediate_rent_product_name"]) + record.irproduct_other = nil + setup_validator.validate_irproduct_other(record) + expect(record.errors["irproduct_other"]) .to include(match I18n.t("validations.setup.intermediate_rent_product_name.blank")) end it "adds an error when the intermediate rent product name is blank but the rent type was given as other intermediate rent product" do record.rent_type = 5 - record.intermediate_rent_product_name = "" - setup_validator.validate_intermediate_rent_product_name(record) - expect(record.errors["intermediate_rent_product_name"]) + record.irproduct_other = "" + setup_validator.validate_irproduct_other(record) + expect(record.errors["irproduct_other"]) .to include(match I18n.t("validations.setup.intermediate_rent_product_name.blank")) end it "Does not add an error when the intermediate rent product name is provided and the rent type was given as other intermediate rent product" do record.rent_type = 5 - record.intermediate_rent_product_name = "Example" - setup_validator.validate_intermediate_rent_product_name(record) - expect(record.errors["intermediate_rent_product_name"]).to be_empty + record.irproduct_other = "Example" + setup_validator.validate_irproduct_other(record) + expect(record.errors["irproduct_other"]).to be_empty end end end diff --git a/spec/services/imports/case_logs_import_service_spec.rb b/spec/services/imports/case_logs_import_service_spec.rb new file mode 100644 index 000000000..7af288654 --- /dev/null +++ b/spec/services/imports/case_logs_import_service_spec.rb @@ -0,0 +1,29 @@ +require "rails_helper" + +RSpec.describe Imports::CaseLogsImportService do + let(:remote_folder) { "case_logs" } + let(:fixture_directory) { "spec/fixtures/softwire_imports/case_logs" } + let(:case_log_id) { "0ead17cb-1668-442d-898c-0d52879ff592" } + let(:case_log_file) { File.open("#{fixture_directory}/#{case_log_id}.xml") } + let(:storage_service) { instance_double(StorageService) } + let(:real_2021_2022_form) { Form.new("config/forms/2021_2022.json", "2021_2022") } + + context "when importing users" do + subject(:case_log_service) { described_class.new(storage_service) } + + before do + # Stub the S3 file listing and download + allow(storage_service).to receive(:list_files) + .and_return(["#{remote_folder}/#{case_log_id}.xml"]) + allow(storage_service).to receive(:get_file_io) + .with("#{remote_folder}/#{case_log_id}.xml") + .and_return(case_log_file) + # Stub the form handler to use the real form + allow(FormHandler.instance).to receive(:get_form).with(anything).and_return(real_2021_2022_form) + end + + it "successfully create a case log with the expected data" do + case_log_service.create_logs(remote_folder) + end + end +end