Browse Source

Update fields exported in lettings export (#2652)

pull/2599/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
9171bbd126
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      app/services/exports/lettings_log_export_constants.rb
  2. 11
      app/services/exports/lettings_log_export_service.rb
  3. 9
      spec/fixtures/exports/general_needs_log.xml
  4. 9
      spec/fixtures/exports/general_needs_log_23_24.xml
  5. 9
      spec/fixtures/exports/general_needs_log_24_25.xml
  6. 11
      spec/fixtures/exports/supported_housing_logs.xml
  7. 3
      spec/services/exports/lettings_log_export_service_spec.rb

5
app/services/exports/lettings_log_export_constants.rb

@ -29,7 +29,6 @@ module Exports::LettingsLogExportConstants
"has_benefits",
"hb",
"hbrentshortfall",
"hcnum",
"hhmemb",
"hhtype",
"homeless",
@ -47,9 +46,7 @@ module Exports::LettingsLogExportConstants
"layear",
"leftreg",
"lettype",
"manhcnum",
"maningorgid",
"maningorgname",
"mantype",
"mobstand",
"mrcdate",
@ -60,7 +57,6 @@ module Exports::LettingsLogExportConstants
"nocharge",
"offered",
"owningorgid",
"owningorgname",
"period",
"uprn",
"uprn_known",
@ -76,7 +72,6 @@ module Exports::LettingsLogExportConstants
"prevloc",
"prevten",
"propcode",
"providertype",
"pscharge",
"reason",
"reasonother",

11
app/services/exports/lettings_log_export_service.rb

@ -57,13 +57,9 @@ module Exports
# Organisation fields
if lettings_log.owning_organisation
attribute_hash["owningorgid"] = lettings_log.owning_organisation.old_visible_id || (lettings_log.owning_organisation.id + LOG_ID_OFFSET)
attribute_hash["owningorgname"] = lettings_log.owning_organisation.name
attribute_hash["hcnum"] = lettings_log.owning_organisation.housing_registration_no
end
if lettings_log.managing_organisation
attribute_hash["maningorgid"] = lettings_log.managing_organisation.old_visible_id || (lettings_log.managing_organisation.id + LOG_ID_OFFSET)
attribute_hash["maningorgname"] = lettings_log.managing_organisation.name
attribute_hash["manhcnum"] = lettings_log.managing_organisation.housing_registration_no
end
# Covert date times to ISO 8601
@ -85,9 +81,9 @@ module Exports
end
attribute_hash["log_id"] = lettings_log.id
attribute_hash["assigned_to"] = lettings_log.assigned_to&.email
attribute_hash["created_by"] = lettings_log.created_by&.email
attribute_hash["amended_by"] = lettings_log.updated_by&.email
attribute_hash["assigned_to"] = lettings_log.assigned_to_id
attribute_hash["created_by"] = lettings_log.created_by_id
attribute_hash["amended_by"] = lettings_log.updated_by_id
attribute_hash["la"] = lettings_log.la
attribute_hash["postcode_full"] = lettings_log.postcode_full
@ -164,7 +160,6 @@ module Exports
form << doc.create_element(key, value)
end
end
form << doc.create_element("providertype", lettings_log.owning_organisation&.read_attribute_before_type_cast(:provider_type))
end
xml_doc_to_temp_file(doc)

9
spec/fixtures/exports/general_needs_log.xml vendored

@ -147,18 +147,13 @@
<duplicate_set_id/>
<formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid>
<owningorgname>MHCLG</owningorgname>
<hcnum>1234</hcnum>
<maningorgid>{managing_org_id}</maningorgid>
<maningorgname>MHCLG</maningorgname>
<manhcnum>1234</manhcnum>
<createddate>2022-05-01T00:00:00+01:00</createddate>
<uploaddate>2022-05-01T00:00:00+01:00</uploaddate>
<log_id>{log_id}</log_id>
<assigned_to>test1@example.com</assigned_to>
<created_by>test1@example.com</created_by>
<assigned_to>{assigned_to}</assigned_to>
<created_by>{created_by}</created_by>
<amended_by/>
<renttype_detail>2</renttype_detail>
<providertype>1</providertype>
</form>
</forms>

9
spec/fixtures/exports/general_needs_log_23_24.xml vendored

@ -148,18 +148,13 @@
<duplicate_set_id/>
<formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid>
<owningorgname>MHCLG</owningorgname>
<hcnum>1234</hcnum>
<maningorgid>{managing_org_id}</maningorgid>
<maningorgname>MHCLG</maningorgname>
<manhcnum>1234</manhcnum>
<createddate>2023-04-03T00:00:00+01:00</createddate>
<uploaddate>2023-04-03T00:00:00+01:00</uploaddate>
<log_id>{log_id}</log_id>
<assigned_to>test1@example.com</assigned_to>
<created_by>test1@example.com</created_by>
<assigned_to>{assigned_to}</assigned_to>
<created_by>{created_by}</created_by>
<amended_by/>
<renttype_detail>2</renttype_detail>
<providertype>1</providertype>
</form>
</forms>

9
spec/fixtures/exports/general_needs_log_24_25.xml vendored

@ -161,18 +161,13 @@
<la_as_entered>la as entered</la_as_entered>
<formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid>
<owningorgname>MHCLG</owningorgname>
<hcnum>1234</hcnum>
<maningorgid>{managing_org_id}</maningorgid>
<maningorgname>MHCLG</maningorgname>
<manhcnum>1234</manhcnum>
<createddate>2024-04-03T00:00:00+01:00</createddate>
<uploaddate>2024-04-03T00:00:00+01:00</uploaddate>
<log_id>{log_id}</log_id>
<assigned_to>test1@example.com</assigned_to>
<created_by>test1@example.com</created_by>
<assigned_to>{assigned_to}</assigned_to>
<created_by>{created_by}</created_by>
<amended_by/>
<renttype_detail>2</renttype_detail>
<providertype>1</providertype>
</form>
</forms>

11
spec/fixtures/exports/supported_housing_logs.xml vendored

@ -146,17 +146,13 @@
<duplicate_set_id/>
<formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid>
<owningorgname>MHCLG</owningorgname>
<hcnum>1234</hcnum>
<maningorgid>{managing_org_id}</maningorgid>
<maningorgname>MHCLG</maningorgname>
<manhcnum>1234</manhcnum>
<createddate>2022-05-01T00:00:00+01:00</createddate>
<uploaddate>2022-05-01T00:00:00+01:00</uploaddate>
<log_id>{log_id}</log_id>
<assigned_to>fake@email.com</assigned_to>
<created_by>fake@email.com</created_by>
<amended_by>other@email.com</amended_by>
<assigned_to>{assigned_to}</assigned_to>
<created_by>{created_by}</created_by>
<amended_by>{amended_by}</amended_by>
<unittype_sh>7</unittype_sh>
<confidential>1</confidential>
<cligrp1>G</cligrp1>
@ -175,6 +171,5 @@
<location_code>{location_id}</location_code>
<location_status>active</location_status>
<renttype_detail>2</renttype_detail>
<providertype>1</providertype>
</form>
</forms>

3
spec/services/exports/lettings_log_export_service_spec.rb

@ -23,6 +23,9 @@ RSpec.describe Exports::LettingsLogExportService do
export_template.sub!(/\{managing_org_id\}/, (lettings_log["managing_organisation_id"] + Exports::LettingsLogExportService::LOG_ID_OFFSET).to_s)
export_template.sub!(/\{location_id\}/, (lettings_log["location_id"]).to_s) if lettings_log.needstype == 2
export_template.sub!(/\{scheme_id\}/, (lettings_log["scheme_id"]).to_s) if lettings_log.needstype == 2
export_template.sub!(/\{assigned_to\}/, lettings_log["assigned_to_id"].to_s)
export_template.sub!(/\{created_by\}/, lettings_log["created_by_id"].to_s)
export_template.sub!(/\{amended_by\}/, lettings_log["updated_by_id"].to_s)
export_template.sub!(/\{log_id\}/, lettings_log["id"].to_s)
end

Loading…
Cancel
Save