Browse Source

Upcase fields and rebase changes

pull/2943/head
Kat 1 month ago
parent
commit
115ce3c29d
  1. 260
      app/services/exports/sales_log_export_constants.rb
  2. 2
      app/services/exports/sales_log_export_service.rb
  3. 298
      spec/fixtures/exports/sales_log.xml
  4. 298
      spec/fixtures/exports/sales_log_2024.xml
  5. 40
      spec/services/exports/sales_log_export_service_spec.rb

260
app/services/exports/sales_log_export_constants.rb

@ -7,140 +7,140 @@ module Exports::SalesLogExportConstants
csv: 2, csv: 2,
}.freeze }.freeze
EXPORT_FIELDS = Set["id", EXPORT_FIELDS = Set["ID",
"status", "STATUS",
"day", "DAY",
"month", "MONTH",
"year", "YEAR",
"duplicate_set_id", "DUPLICATE_SET_ID",
"createddate", "CREATEDDATE",
"uploaddate", "UPLOADDATE",
"owningorgid", "OWNINGORGID",
"owningorgname", "OWNINGORGNAME",
"maningorgid", "MANINGORGID",
"maningorgname", "MANINGORGNAME",
"username", "USERNAME",
"usernameid", "USERNAMEID",
"purchid", "PURCHID",
"type", "TYPE",
"ownership", "OWNERSHIP",
"collectionyear", "COLLECTIONYEAR",
"jointmore", "JOINTMORE",
"joint", "JOINT",
"beds", "BEDS",
"ethnic", "ETHNIC",
"ethnicgroup1", "ETHNICGROUP1",
"liveinbuyer1", "LIVEINBUYER1",
"builtype", "BUILTYPE",
"proptype", "PROPTYPE",
"noint", "NOINT",
"liveinbuyer2", "LIVEINBUYER2",
"privacynotice", "PRIVACYNOTICE",
"wheel", "WHEEL",
"hholdcount", "HHOLDCOUNT",
"la", "LA",
"income1", "INCOME1",
"inc1nk", "INC1NK",
"inc1mort", "INC1MORT",
"income2", "INCOME2",
"inc2nk", "INC2NK",
"savingsnk", "SAVINGSNK",
"savings", "SAVINGS",
"prevown", "PREVOWN",
"amendedby", "AMENDEDBY",
"amendedbyid", "AMENDEDBYID",
"mortgage", "MORTGAGE",
"inc2mort", "INC2MORT",
"hb", "HB",
"frombeds", "FROMBEDS",
"staircase", "STAIRCASE",
"stairbought", "STAIRBOUGHT",
"stairowned", "STAIROWNED",
"mrent", "MRENT",
"mrentprestaircasing", "MRENTPRESTAIRCASING",
"resale", "RESALE",
"deposit", "DEPOSIT",
"cashdis", "CASHDIS",
"disabled", "DISABLED",
"value", "VALUE",
"equity", "EQUITY",
"discount", "DISCOUNT",
"grant", "GRANT",
"ppcodenk", "PPCODENK",
"ppostc1", "PPOSTC1",
"ppostc2", "PPOSTC2",
"prevloc", "PREVLOC",
"prevlocname", "PREVLOCNAME",
"previouslaknown", "PREVIOUSLAKNOWN",
"hhregres", "HHREGRES",
"hhregresstill", "HHREGRESSTILL",
"proplen", "PROPLEN",
"hasmscharge", "HASMSCHARGE",
"mscharge", "MSCHARGE",
"prevten", "PREVTEN",
"mortgageused", "MORTGAGEUSED",
"wchair", "WCHAIR",
"armedforcesspouse", "ARMEDFORCESSPOUSE",
"hoday", "HODAY",
"homonth", "HOMONTH",
"hoyear", "HOYEAR",
"fromprop", "FROMPROP",
"socprevten", "SOCPREVTEN",
"mortlen1", "MORTLEN1",
"extrabor", "EXTRABOR",
"hhtype", "HHTYPE",
"postcode", "POSTCODE",
"islainferred", "ISLAINFERRED",
"bulkuploadid", "BULKUPLOADID",
"value_value_check", "VALUE_VALUE_CHECK",
"prevshared", "PREVSHARED",
"staircasesale", "STAIRCASESALE",
"ethnicgroup2", "ETHNICGROUP2",
"ethnic2", "ETHNIC2",
"buy2living", "BUY2LIVING",
"prevten2", "PREVTEN2",
"uprn", "UPRN",
"address1", "ADDRESS1",
"address2", "ADDRESS2",
"towncity", "TOWNCITY",
"county", "COUNTY",
"laname", "LANAME",
"creationmethod", "CREATIONMETHOD",
"nationalityall1", "NATIONALITYALL1",
"nationalityall2", "NATIONALITYALL2",
"mscharge_value_check", "MSCHARGE_VALUE_CHECK",
"address1input", "ADDRESS1INPUT",
"postcodeinput", "POSTCODEINPUT",
"address_search_value_check", "ADDRESS_SEARCH_VALUE_CHECK",
"uprnselected", "UPRNSELECTED",
"bulkaddress1", "BULKADDRESS1",
"bulkaddress2", "BULKADDRESS2",
"bulktowncity", "BULKTOWNCITY",
"bulkcounty", "BULKCOUNTY",
"bulkpostcode", "BULKPOSTCODE",
"bulkla", "BULKLA",
"createdby", "CREATEDBY",
"createdbyid", "CREATEDBYID",
"hasestatefee", "HASESTATEFEE",
"estatefee", "ESTATEFEE",
"firststair", "FIRSTSTAIR",
"numstair", "NUMSTAIR",
"stairlastday", "STAIRLASTDAY",
"stairlastmonth", "STAIRLASTMONTH",
"stairlastyear", "STAIRLASTYEAR",
"stairinitialyear", "STAIRINITIALYEAR",
"stairinitialmonth", "STAIRINITIALMONTH",
"stairinitialday", "STAIRINITIALDAY",
"hasservicecharges", "HASSERVICECHARGES",
"servicecharges",] "SERVICECHARGES",]
(1..6).each do |index| (1..6).each do |index|
EXPORT_FIELDS << "age#{index}" EXPORT_FIELDS << "AGE#{index}"
EXPORT_FIELDS << "ecstat#{index}" EXPORT_FIELDS << "ECSTAT#{index}"
EXPORT_FIELDS << "sex#{index}" EXPORT_FIELDS << "SEX#{index}"
end end
(2..6).each do |index| (2..6).each do |index|
EXPORT_FIELDS << "relat#{index}" EXPORT_FIELDS << "RELAT#{index}"
end end
end end

2
app/services/exports/sales_log_export_service.rb

@ -117,6 +117,8 @@ module Exports
attribute_hash["stairinitialmonth"] = sales_log.initialpurchase&.month attribute_hash["stairinitialmonth"] = sales_log.initialpurchase&.month
attribute_hash["stairinitialyear"] = sales_log.initialpurchase&.year attribute_hash["stairinitialyear"] = sales_log.initialpurchase&.year
attribute_hash["mscharge_value_check"] = sales_log.monthly_charges_value_check attribute_hash["mscharge_value_check"] = sales_log.monthly_charges_value_check
attribute_hash.transform_keys!(&:upcase)
attribute_hash attribute_hash
end end

298
spec/fixtures/exports/sales_log.xml vendored

@ -1,154 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<forms> <forms>
<form> <form>
<id>{id}</id> <ID>{id}</ID>
<status>1</status> <STATUS>1</STATUS>
<purchid>123</purchid> <PURCHID>123</PURCHID>
<type>8</type> <TYPE>8</TYPE>
<jointmore>1</jointmore> <JOINTMORE>1</JOINTMORE>
<beds>2</beds> <BEDS>2</BEDS>
<age1>27</age1> <AGE1>27</AGE1>
<sex1>F</sex1> <SEX1>F</SEX1>
<ethnic>17</ethnic> <ETHNIC>17</ETHNIC>
<builtype>1</builtype> <BUILTYPE>1</BUILTYPE>
<proptype>1</proptype> <PROPTYPE>1</PROPTYPE>
<age2>33</age2> <AGE2>33</AGE2>
<relat2>P</relat2> <RELAT2>P</RELAT2>
<sex2>X</sex2> <SEX2>X</SEX2>
<noint>2</noint> <NOINT>2</NOINT>
<ecstat2>1</ecstat2> <ECSTAT2>1</ECSTAT2>
<privacynotice>1</privacynotice> <PRIVACYNOTICE>1</PRIVACYNOTICE>
<ecstat1>1</ecstat1> <ECSTAT1>1</ECSTAT1>
<wheel>1</wheel> <WHEEL>1</WHEEL>
<hholdcount>4</hholdcount> <HHOLDCOUNT>4</HHOLDCOUNT>
<age3>14</age3> <AGE3>14</AGE3>
<la>E09000033</la> <LA>E09000033</LA>
<income1>10000</income1> <INCOME1>10000</INCOME1>
<age4>18</age4> <AGE4>18</AGE4>
<age5>40</age5> <AGE5>40</AGE5>
<age6>40</age6> <AGE6>40</AGE6>
<inc1mort>1</inc1mort> <INC1MORT>1</INC1MORT>
<income2>10000</income2> <INCOME2>10000</INCOME2>
<savingsnk>1</savingsnk> <SAVINGSNK>1</SAVINGSNK>
<savings/> <SAVINGS/>
<prevown>1</prevown> <PREVOWN>1</PREVOWN>
<sex3>F</sex3> <SEX3>F</SEX3>
<mortgage>20000.0</mortgage> <MORTGAGE>20000.0</MORTGAGE>
<inc2mort>1</inc2mort> <INC2MORT>1</INC2MORT>
<ecstat3>9</ecstat3> <ECSTAT3>9</ECSTAT3>
<ecstat4>3</ecstat4> <ECSTAT4>3</ECSTAT4>
<ecstat5>2</ecstat5> <ECSTAT5>2</ECSTAT5>
<ecstat6>1</ecstat6> <ECSTAT6>1</ECSTAT6>
<relat3>X</relat3> <RELAT3>X</RELAT3>
<relat4>X</relat4> <RELAT4>X</RELAT4>
<relat5>R</relat5> <RELAT5>R</RELAT5>
<relat6>R</relat6> <RELAT6>R</RELAT6>
<hb>4</hb> <HB>4</HB>
<sex4>X</sex4> <SEX4>X</SEX4>
<sex5>M</sex5> <SEX5>M</SEX5>
<sex6>X</sex6> <SEX6>X</SEX6>
<frombeds/> <FROMBEDS/>
<staircase/> <STAIRCASE/>
<stairbought/> <STAIRBOUGHT/>
<stairowned/> <STAIROWNED/>
<mrent/> <MRENT/>
<resale/> <RESALE/>
<deposit>80000.0</deposit> <DEPOSIT>80000.0</DEPOSIT>
<cashdis/> <CASHDIS/>
<disabled>1</disabled> <DISABLED>1</DISABLED>
<value>110000.0</value> <VALUE>110000.0</VALUE>
<equity/> <EQUITY/>
<discount/> <DISCOUNT/>
<grant>10000.0</grant> <GRANT>10000.0</GRANT>
<ppcodenk>0</ppcodenk> <PPCODENK>0</PPCODENK>
<ppostc1>SW1A</ppostc1> <PPOSTC1>SW1A</PPOSTC1>
<ppostc2>1AA</ppostc2> <PPOSTC2>1AA</PPOSTC2>
<prevloc>E09000033</prevloc> <PREVLOC>E09000033</PREVLOC>
<hhregres>7</hhregres> <HHREGRES>7</HHREGRES>
<hhregresstill/> <HHREGRESSTILL/>
<proplen/> <PROPLEN/>
<mscharge>100.0</mscharge> <MSCHARGE>100.0</MSCHARGE>
<prevten>1</prevten> <PREVTEN>1</PREVTEN>
<mortgageused>1</mortgageused> <MORTGAGEUSED>1</MORTGAGEUSED>
<wchair>1</wchair> <WCHAIR>1</WCHAIR>
<armedforcesspouse>5</armedforcesspouse> <ARMEDFORCESSPOUSE>5</ARMEDFORCESSPOUSE>
<hoday/> <HODAY/>
<homonth/> <HOMONTH/>
<hoyear/> <HOYEAR/>
<fromprop/> <FROMPROP/>
<socprevten/> <SOCPREVTEN/>
<extrabor>1</extrabor> <EXTRABOR>1</EXTRABOR>
<hhtype>6</hhtype> <HHTYPE>6</HHTYPE>
<value_value_check/> <VALUE_VALUE_CHECK/>
<prevshared>2</prevshared> <PREVSHARED>2</PREVSHARED>
<staircasesale/> <STAIRCASESALE/>
<buy2living>3</buy2living> <BUY2LIVING>3</BUY2LIVING>
<uprn>1</uprn> <UPRN/>
<county/> <COUNTY/>
<duplicate_set_id/> <DUPLICATE_SET_ID/>
<address_search_value_check/> <ADDRESS_SEARCH_VALUE_CHECK/>
<firststair/> <FIRSTSTAIR/>
<numstair/> <NUMSTAIR/>
<mrentprestaircasing/> <MRENTPRESTAIRCASING/>
<day>1</day> <DAY>1</DAY>
<month>3</month> <MONTH>3</MONTH>
<year>2026</year> <YEAR>2026</YEAR>
<createddate>2026-03-01T00:00:00+00:00</createddate> <CREATEDDATE>2026-03-01T00:00:00+00:00</CREATEDDATE>
<createdby>{created_by_email}</createdby> <CREATEDBY>{created_by_email}</CREATEDBY>
<createdbyid>{created_by_id}</createdbyid> <CREATEDBYID>{created_by_id}</CREATEDBYID>
<username>{assigned_to_email}</username> <USERNAME>{assigned_to_email}</USERNAME>
<usernameid>{assigned_to_id}</usernameid> <USERNAMEID>{assigned_to_id}</USERNAMEID>
<uploaddate>2026-03-01T00:00:00+00:00</uploaddate> <UPLOADDATE>2026-03-01T00:00:00+00:00</UPLOADDATE>
<amendedby/> <AMENDEDBY/>
<amendedbyid/> <AMENDEDBYID/>
<owningorgid>{owning_org_id}</owningorgid> <OWNINGORGID>{owning_org_id}</OWNINGORGID>
<owningorgname>{owning_org_name}</owningorgname> <OWNINGORGNAME>{owning_org_name}</OWNINGORGNAME>
<maningorgid>{managing_org_id}</maningorgid> <MANINGORGID>{managing_org_id}</MANINGORGID>
<maningorgname>{managing_org_name}</maningorgname> <MANINGORGNAME>{managing_org_name}</MANINGORGNAME>
<creationmethod>1</creationmethod> <CREATIONMETHOD>1</CREATIONMETHOD>
<bulkuploadid/> <BULKUPLOADID/>
<collectionyear>2025</collectionyear> <COLLECTIONYEAR>2025</COLLECTIONYEAR>
<ownership>2</ownership> <OWNERSHIP>2</OWNERSHIP>
<joint>1</joint> <JOINT>1</JOINT>
<ethnicgroup1>17</ethnicgroup1> <ETHNICGROUP1>17</ETHNICGROUP1>
<ethnicgroup2>17</ethnicgroup2> <ETHNICGROUP2>17</ETHNICGROUP2>
<previouslaknown>1</previouslaknown> <PREVIOUSLAKNOWN>1</PREVIOUSLAKNOWN>
<hasmscharge>1</hasmscharge> <HASMSCHARGE>1</HASMSCHARGE>
<hasservicecharges/> <HASSERVICECHARGES/>
<servicecharges/> <SERVICECHARGES/>
<inc1nk>0</inc1nk> <INC1NK>0</INC1NK>
<inc2nk>0</inc2nk> <INC2NK>0</INC2NK>
<postcode>AA1 1AA</postcode> <POSTCODE>SW1A 1AA</POSTCODE>
<islainferred>true</islainferred> <ISLAINFERRED>true</ISLAINFERRED>
<mortlen1>10</mortlen1> <MORTLEN1>10</MORTLEN1>
<ethnic2/> <ETHNIC2/>
<prevten2/> <PREVTEN2/>
<address1>1, Test Street</address1> <ADDRESS1>Address line 1</ADDRESS1>
<address2/> <ADDRESS2/>
<towncity>Test Town</towncity> <TOWNCITY>City</TOWNCITY>
<laname>Westminster</laname> <LANAME>Westminster</LANAME>
<address1input>Address line 1</address1input> <ADDRESS1INPUT>Address line 1</ADDRESS1INPUT>
<postcodeinput>SW1A 1AA</postcodeinput> <POSTCODEINPUT>SW1A 1AA</POSTCODEINPUT>
<uprnselected/> <UPRNSELECTED/>
<bulkaddress1/> <BULKADDRESS1/>
<bulkaddress2/> <BULKADDRESS2/>
<bulktowncity/> <BULKTOWNCITY/>
<bulkcounty/> <BULKCOUNTY/>
<bulkpostcode/> <BULKPOSTCODE/>
<bulkla/> <BULKLA/>
<nationalityall1>826</nationalityall1> <NATIONALITYALL1>826</NATIONALITYALL1>
<nationalityall2>826</nationalityall2> <NATIONALITYALL2>826</NATIONALITYALL2>
<prevlocname>Westminster</prevlocname> <PREVLOCNAME>Westminster</PREVLOCNAME>
<liveinbuyer1>1</liveinbuyer1> <LIVEINBUYER1>1</LIVEINBUYER1>
<liveinbuyer2>1</liveinbuyer2> <LIVEINBUYER2>1</LIVEINBUYER2>
<hasestatefee/> <HASESTATEFEE/>
<estatefee/> <ESTATEFEE/>
<stairlastday/> <STAIRLASTDAY/>
<stairlastmonth/> <STAIRLASTMONTH/>
<stairlastyear/> <STAIRLASTYEAR/>
<stairinitialday/> <STAIRINITIALDAY/>
<stairinitialmonth/> <STAIRINITIALMONTH/>
<stairinitialyear/> <STAIRINITIALYEAR/>
<mscharge_value_check/> <MSCHARGE_VALUE_CHECK/>
</form> </form>
</forms> </forms>

298
spec/fixtures/exports/sales_log_2024.xml vendored

@ -1,154 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<forms> <forms>
<form> <form>
<id>{id}</id> <ID>{id}</ID>
<status>2</status> <STATUS>2</STATUS>
<purchid>123</purchid> <PURCHID>123</PURCHID>
<type>8</type> <TYPE>8</TYPE>
<jointmore>1</jointmore> <JOINTMORE>1</JOINTMORE>
<beds>2</beds> <BEDS>2</BEDS>
<age1>27</age1> <AGE1>27</AGE1>
<sex1>F</sex1> <SEX1>F</SEX1>
<ethnic>17</ethnic> <ETHNIC>17</ETHNIC>
<builtype>1</builtype> <BUILTYPE>1</BUILTYPE>
<proptype>1</proptype> <PROPTYPE>1</PROPTYPE>
<age2>33</age2> <AGE2>33</AGE2>
<relat2>P</relat2> <RELAT2>P</RELAT2>
<sex2>X</sex2> <SEX2>X</SEX2>
<noint>2</noint> <NOINT>2</NOINT>
<ecstat2>1</ecstat2> <ECSTAT2>1</ECSTAT2>
<privacynotice>1</privacynotice> <PRIVACYNOTICE>1</PRIVACYNOTICE>
<ecstat1>1</ecstat1> <ECSTAT1>1</ECSTAT1>
<wheel>1</wheel> <WHEEL>1</WHEEL>
<hholdcount>4</hholdcount> <HHOLDCOUNT>4</HHOLDCOUNT>
<age3>14</age3> <AGE3>14</AGE3>
<la>E09000033</la> <LA>E09000033</LA>
<income1>10000</income1> <INCOME1>10000</INCOME1>
<age4>18</age4> <AGE4>18</AGE4>
<age5>40</age5> <AGE5>40</AGE5>
<age6>40</age6> <AGE6>40</AGE6>
<inc1mort>1</inc1mort> <INC1MORT>1</INC1MORT>
<income2>10000</income2> <INCOME2>10000</INCOME2>
<savingsnk>1</savingsnk> <SAVINGSNK>1</SAVINGSNK>
<savings/> <SAVINGS/>
<prevown>1</prevown> <PREVOWN>1</PREVOWN>
<sex3>F</sex3> <SEX3>F</SEX3>
<mortgage>20000.0</mortgage> <MORTGAGE>20000.0</MORTGAGE>
<inc2mort>1</inc2mort> <INC2MORT>1</INC2MORT>
<ecstat3>9</ecstat3> <ECSTAT3>9</ECSTAT3>
<ecstat4>3</ecstat4> <ECSTAT4>3</ECSTAT4>
<ecstat5>2</ecstat5> <ECSTAT5>2</ECSTAT5>
<ecstat6>1</ecstat6> <ECSTAT6>1</ECSTAT6>
<relat3>X</relat3> <RELAT3>X</RELAT3>
<relat4>X</relat4> <RELAT4>X</RELAT4>
<relat5>R</relat5> <RELAT5>R</RELAT5>
<relat6>R</relat6> <RELAT6>R</RELAT6>
<hb>4</hb> <HB>4</HB>
<sex4>X</sex4> <SEX4>X</SEX4>
<sex5>M</sex5> <SEX5>M</SEX5>
<sex6>X</sex6> <SEX6>X</SEX6>
<frombeds/> <FROMBEDS/>
<staircase/> <STAIRCASE/>
<stairbought/> <STAIRBOUGHT/>
<stairowned/> <STAIROWNED/>
<mrent/> <MRENT/>
<resale/> <RESALE/>
<deposit>80000.0</deposit> <DEPOSIT>80000.0</DEPOSIT>
<cashdis/> <CASHDIS/>
<disabled>1</disabled> <DISABLED>1</DISABLED>
<value>110000.0</value> <VALUE>110000.0</VALUE>
<equity/> <EQUITY/>
<discount/> <DISCOUNT/>
<grant>10000.0</grant> <GRANT>10000.0</GRANT>
<ppcodenk>0</ppcodenk> <PPCODENK>0</PPCODENK>
<ppostc1>SW1A</ppostc1> <PPOSTC1>SW1A</PPOSTC1>
<ppostc2>1AA</ppostc2> <PPOSTC2>1AA</PPOSTC2>
<prevloc>E09000033</prevloc> <PREVLOC>E09000033</PREVLOC>
<hhregres>7</hhregres> <HHREGRES>7</HHREGRES>
<hhregresstill/> <HHREGRESSTILL/>
<proplen/> <PROPLEN/>
<mscharge>100.0</mscharge> <MSCHARGE>100.0</MSCHARGE>
<prevten>1</prevten> <PREVTEN>1</PREVTEN>
<mortgageused>1</mortgageused> <MORTGAGEUSED>1</MORTGAGEUSED>
<wchair>1</wchair> <WCHAIR>1</WCHAIR>
<armedforcesspouse>5</armedforcesspouse> <ARMEDFORCESSPOUSE>5</ARMEDFORCESSPOUSE>
<hoday/> <HODAY/>
<homonth/> <HOMONTH/>
<hoyear/> <HOYEAR/>
<fromprop/> <FROMPROP/>
<socprevten/> <SOCPREVTEN/>
<extrabor>1</extrabor> <EXTRABOR>1</EXTRABOR>
<hhtype>6</hhtype> <HHTYPE>6</HHTYPE>
<value_value_check/> <VALUE_VALUE_CHECK/>
<prevshared>2</prevshared> <PREVSHARED>2</PREVSHARED>
<staircasesale/> <STAIRCASESALE/>
<buy2living>3</buy2living> <BUY2LIVING>3</BUY2LIVING>
<uprn>1</uprn> <UPRN/>
<county/> <COUNTY/>
<duplicate_set_id/> <DUPLICATE_SET_ID/>
<address_search_value_check/> <ADDRESS_SEARCH_VALUE_CHECK/>
<firststair/> <FIRSTSTAIR/>
<numstair/> <NUMSTAIR/>
<mrentprestaircasing/> <MRENTPRESTAIRCASING/>
<day>3</day> <DAY>3</DAY>
<month>4</month> <MONTH>4</MONTH>
<year>2024</year> <YEAR>2024</YEAR>
<createddate>2024-04-03T00:00:00+01:00</createddate> <CREATEDDATE>2024-04-03T00:00:00+01:00</CREATEDDATE>
<createdby>{created_by_email}</createdby> <CREATEDBY>{created_by_email}</CREATEDBY>
<createdbyid>{created_by_id}</createdbyid> <CREATEDBYID>{created_by_id}</CREATEDBYID>
<username>{assigned_to_email}</username> <USERNAME>{assigned_to_email}</USERNAME>
<usernameid>{assigned_to_id}</usernameid> <USERNAMEID>{assigned_to_id}</USERNAMEID>
<uploaddate>2024-04-03T00:00:00+01:00</uploaddate> <UPLOADDATE>2024-04-03T00:00:00+01:00</UPLOADDATE>
<amendedby/> <AMENDEDBY/>
<amendedbyid/> <AMENDEDBYID/>
<owningorgid>{owning_org_id}</owningorgid> <OWNINGORGID>{owning_org_id}</OWNINGORGID>
<owningorgname>{owning_org_name}</owningorgname> <OWNINGORGNAME>{owning_org_name}</OWNINGORGNAME>
<maningorgid>{managing_org_id}</maningorgid> <MANINGORGID>{managing_org_id}</MANINGORGID>
<maningorgname>{managing_org_name}</maningorgname> <MANINGORGNAME>{managing_org_name}</MANINGORGNAME>
<creationmethod>1</creationmethod> <CREATIONMETHOD>1</CREATIONMETHOD>
<bulkuploadid/> <BULKUPLOADID/>
<collectionyear>2024</collectionyear> <COLLECTIONYEAR>2024</COLLECTIONYEAR>
<ownership>2</ownership> <OWNERSHIP>2</OWNERSHIP>
<joint>1</joint> <JOINT>1</JOINT>
<ethnicgroup1>17</ethnicgroup1> <ETHNICGROUP1>17</ETHNICGROUP1>
<ethnicgroup2>17</ethnicgroup2> <ETHNICGROUP2>17</ETHNICGROUP2>
<previouslaknown>1</previouslaknown> <PREVIOUSLAKNOWN>1</PREVIOUSLAKNOWN>
<hasmscharge>1</hasmscharge> <HASMSCHARGE>1</HASMSCHARGE>
<hasservicecharges/> <HASSERVICECHARGES/>
<servicecharges/> <SERVICECHARGES/>
<inc1nk>0</inc1nk> <INC1NK>0</INC1NK>
<inc2nk>0</inc2nk> <INC2NK>0</INC2NK>
<postcode>AA1 1AA</postcode> <POSTCODE>SW1A 1AA</POSTCODE>
<islainferred>true</islainferred> <ISLAINFERRED>true</ISLAINFERRED>
<mortlen1>10</mortlen1> <MORTLEN1>10</MORTLEN1>
<ethnic2/> <ETHNIC2/>
<prevten2/> <PREVTEN2/>
<address1>1, Test Street</address1> <ADDRESS1>Address line 1</ADDRESS1>
<address2/> <ADDRESS2/>
<towncity>Test Town</towncity> <TOWNCITY>City</TOWNCITY>
<laname>Westminster</laname> <LANAME>Westminster</LANAME>
<address1input>Address line 1</address1input> <ADDRESS1INPUT>Address line 1</ADDRESS1INPUT>
<postcodeinput>SW1A 1AA</postcodeinput> <POSTCODEINPUT>SW1A 1AA</POSTCODEINPUT>
<uprnselected/> <UPRNSELECTED/>
<bulkaddress1/> <BULKADDRESS1/>
<bulkaddress2/> <BULKADDRESS2/>
<bulktowncity/> <BULKTOWNCITY/>
<bulkcounty/> <BULKCOUNTY/>
<bulkpostcode/> <BULKPOSTCODE/>
<bulkla/> <BULKLA/>
<nationalityall1>826</nationalityall1> <NATIONALITYALL1>826</NATIONALITYALL1>
<nationalityall2>826</nationalityall2> <NATIONALITYALL2>826</NATIONALITYALL2>
<prevlocname>Westminster</prevlocname> <PREVLOCNAME>Westminster</PREVLOCNAME>
<liveinbuyer1>1</liveinbuyer1> <LIVEINBUYER1>1</LIVEINBUYER1>
<liveinbuyer2>1</liveinbuyer2> <LIVEINBUYER2>1</LIVEINBUYER2>
<hasestatefee/> <HASESTATEFEE/>
<estatefee/> <ESTATEFEE/>
<stairlastday/> <STAIRLASTDAY/>
<stairlastmonth/> <STAIRLASTMONTH/>
<stairlastyear/> <STAIRLASTYEAR/>
<stairinitialday/> <STAIRINITIALDAY/>
<stairinitialmonth/> <STAIRINITIALMONTH/>
<stairinitialyear/> <STAIRINITIALYEAR/>
<mscharge_value_check/> <MSCHARGE_VALUE_CHECK/>
</form> </form>
</forms> </forms>

40
spec/services/exports/sales_log_export_service_spec.rb

@ -315,7 +315,7 @@ RSpec.describe Exports::SalesLogExportService do
let!(:sales_log) { FactoryBot.create(:sales_log, :export, duplicate_set_id: 123) } let!(:sales_log) { FactoryBot.create(:sales_log, :export, duplicate_set_id: 123) }
def replace_duplicate_set_id(export_file) def replace_duplicate_set_id(export_file)
export_file.sub!("<duplicate_set_id/>", "<duplicate_set_id>123</duplicate_set_id>") export_file.sub!("<DUPLICATE_SET_ID/>", "<DUPLICATE_SET_ID>123</DUPLICATE_SET_ID>")
end end
it "generates an XML export file with the expected content within the ZIP file" do it "generates an XML export file with the expected content within the ZIP file" do
@ -368,7 +368,7 @@ RSpec.describe Exports::SalesLogExportService do
let!(:sales_log) { FactoryBot.create(:sales_log, :export, mscharge: 123) } let!(:sales_log) { FactoryBot.create(:sales_log, :export, mscharge: 123) }
def replace_mscharge_value(export_file) def replace_mscharge_value(export_file)
export_file.sub!("<mscharge>100.0</mscharge>", "<mscharge>123.0</mscharge>") export_file.sub!("<MSCHARGE>100.0</MSCHARGE>", "<MSCHARGE>123.0</MSCHARGE>")
end end
it "exports mscharge fields as hasmscharge and mscharge" do it "exports mscharge fields as hasmscharge and mscharge" do
@ -388,24 +388,24 @@ RSpec.describe Exports::SalesLogExportService do
let!(:sales_log) { FactoryBot.create(:sales_log, :export, ownershipsch: 1, staircase: 2, type: 30, mscharge: 321, has_management_fee: 1, management_fee: 222) } let!(:sales_log) { FactoryBot.create(:sales_log, :export, ownershipsch: 1, staircase: 2, type: 30, mscharge: 321, has_management_fee: 1, management_fee: 222) }
def replace_mscharge_and_shared_ownership_values(export_file) def replace_mscharge_and_shared_ownership_values(export_file)
export_file.sub!("<hasservicecharges/>", "<hasservicecharges>1</hasservicecharges>") export_file.sub!("<HASSERVICECHARGES/>", "<HASSERVICECHARGES>1</HASSERVICECHARGES>")
export_file.sub!("<servicecharges/>", "<servicecharges>321.0</servicecharges>") export_file.sub!("<SERVICECHARGES/>", "<SERVICECHARGES>321.0</SERVICECHARGES>")
export_file.sub!("<hasestatefee/>", "<hasestatefee>1</hasestatefee>") export_file.sub!("<HASESTATEFEE/>", "<HASESTATEFEE>1</HASESTATEFEE>")
export_file.sub!("<estatefee/>", "<estatefee>222.0</estatefee>") export_file.sub!("<ESTATEFEE/>", "<ESTATEFEE>222.0</ESTATEFEE>")
export_file.sub!("<mscharge>100.0</mscharge>", "<mscharge/>") export_file.sub!("<MSCHARGE>100.0</MSCHARGE>", "<MSCHARGE/>")
export_file.sub!("<hasmscharge>1</hasmscharge>", "<hasmscharge/>") export_file.sub!("<HASMSCHARGE>1</HASMSCHARGE>", "<HASMSCHARGE/>")
export_file.sub!("<type>8</type>", "<type>30</type>") export_file.sub!("<TYPE>8</TYPE>", "<TYPE>30</TYPE>")
export_file.sub!("<staircase/>", "<staircase>2</staircase>") export_file.sub!("<STAIRCASE/>", "<STAIRCASE>2</STAIRCASE>")
export_file.sub!("<grant>10000.0</grant>", "<grant/>") export_file.sub!("<GRANT>10000.0</GRANT>", "<GRANT/>")
export_file.sub!("<ppcodenk>0</ppcodenk>", "<ppcodenk>1</ppcodenk>") export_file.sub!("<PPCODENK>0</PPCODENK>", "<PPCODENK>1</PPCODENK>")
export_file.sub!("<ppostc1>SW1A</ppostc1>", "<ppostc1/>") export_file.sub!("<PPOSTC1>SW1A</PPOSTC1>", "<PPOSTC1/>")
export_file.sub!("<ppostc2>1AA</ppostc2>", "<ppostc2/>") export_file.sub!("<PPOSTC2>1AA</PPOSTC2>", "<PPOSTC2/>")
export_file.sub!("<prevloc>E09000033</prevloc>", "<prevloc/>") export_file.sub!("<PREVLOC>E09000033</PREVLOC>", "<PREVLOC/>")
export_file.sub!("<extrabor>1</extrabor>", "<extrabor/>") export_file.sub!("<EXTRABOR>1</EXTRABOR>", "<EXTRABOR/>")
export_file.sub!("<ownership>2</ownership>", "<ownership>1</ownership>") export_file.sub!("<OWNERSHIP>2</OWNERSHIP>", "<OWNERSHIP>1</OWNERSHIP>")
export_file.sub!("<previouslaknown>1</previouslaknown>", "<previouslaknown>0</previouslaknown>") export_file.sub!("<PREVIOUSLAKNOWN>1</PREVIOUSLAKNOWN>", "<PREVIOUSLAKNOWN>0</PREVIOUSLAKNOWN>")
export_file.sub!("<prevlocname>Westminster</prevlocname>", "<prevlocname/>") export_file.sub!("<PREVLOCNAME>Westminster</PREVLOCNAME>", "<PREVLOCNAME/>")
end end
it "exports mscharge fields as hasmscharge and mscharge" do it "exports mscharge fields as hasmscharge and mscharge" do

Loading…
Cancel
Save