Browse Source

CLDC-4176: Remove sexn from XML export

pull/3201/head
samyou-softwire 3 weeks ago
parent
commit
c86f814c40
  1. 13
      app/services/exports/sales_log_export_constants.rb
  2. 4
      app/services/exports/sales_log_export_service.rb
  3. 6
      spec/factories/sales_log.rb
  4. 18
      spec/fixtures/exports/sales_log_26_27.xml
  5. 10
      spec/services/exports/sales_log_export_service_spec.rb

13
app/services/exports/sales_log_export_constants.rb

@ -139,13 +139,24 @@ module Exports::SalesLogExportConstants
(1..6).each do |index|
ALL_YEAR_EXPORT_FIELDS << "AGE#{index}"
ALL_YEAR_EXPORT_FIELDS << "ECSTAT#{index}"
ALL_YEAR_EXPORT_FIELDS << "SEX#{index}"
end
(2..6).each do |index|
ALL_YEAR_EXPORT_FIELDS << "RELAT#{index}"
end
YEAR_2024_EXPORT_FIELDS = Set[]
(1..6).each do |index|
YEAR_2024_EXPORT_FIELDS << "SEX#{index}"
end
YEAR_2025_EXPORT_FIELDS = Set[]
(1..6).each do |index|
YEAR_2025_EXPORT_FIELDS << "SEX#{index}"
end
YEAR_2026_EXPORT_FIELDS = Set["BUILDHEIGHTCLASS"]
(1..6).each do |index|

4
app/services/exports/sales_log_export_service.rb

@ -159,6 +159,10 @@ module Exports
included_fields.merge(ALL_YEAR_EXPORT_FIELDS)
year_fields = case sales_log.collection_start_year
when 2024
YEAR_2024_EXPORT_FIELDS
when 2025
YEAR_2025_EXPORT_FIELDS
when 2026
YEAR_2026_EXPORT_FIELDS
else

6
spec/factories/sales_log.rb

@ -300,7 +300,7 @@ FactoryBot.define do
builtype { 1 }
ethnic { 3 }
ethnic_group { 17 }
sexrab2 { "X" }
sexrab2 { "R" }
sex2 { "X" }
buy2livein { "1" }
ecstat1 { "1" }
@ -335,11 +335,11 @@ FactoryBot.define do
prevshared { 2 }
sexrab3 { "F" }
sex3 { "F" }
sexrab4 { "X" }
sexrab4 { "R" }
sex4 { "X" }
sexrab5 { "M" }
sex5 { "M" }
sexrab6 { "X" }
sexrab6 { "R" }
sex6 { "X" }
mortgage { 20_000 }
ecstat3 { 9 }

18
spec/fixtures/exports/sales_log_26_27.xml vendored

@ -8,13 +8,13 @@
<JOINTMORE>1</JOINTMORE>
<BEDS>2</BEDS>
<AGE1>27</AGE1>
<SEX1>F</SEX1>
<SEXRAB1>F</SEXRAB1>
<ETHNIC>17</ETHNIC>
<BUILTYPE>1</BUILTYPE>
<PROPTYPE>1</PROPTYPE>
<AGE2>33</AGE2>
<RELAT2>P</RELAT2>
<SEX2>X</SEX2>
<SEXRAB2>R</SEXRAB2>
<NOINT>2</NOINT>
<ECSTAT2>1</ECSTAT2>
<PRIVACYNOTICE>1</PRIVACYNOTICE>
@ -32,7 +32,7 @@
<SAVINGSNK>1</SAVINGSNK>
<SAVINGS/>
<PREVOWN>1</PREVOWN>
<SEX3>F</SEX3>
<SEXRAB3>F</SEXRAB3>
<MORTGAGE>20000.0</MORTGAGE>
<INC2MORT>1</INC2MORT>
<ECSTAT3>9</ECSTAT3>
@ -44,9 +44,9 @@
<RELAT5>R</RELAT5>
<RELAT6>R</RELAT6>
<HB>4</HB>
<SEX4>X</SEX4>
<SEX5>M</SEX5>
<SEX6>X</SEX6>
<SEXRAB4>R</SEXRAB4>
<SEXRAB5>M</SEXRAB5>
<SEXRAB6>R</SEXRAB6>
<FROMBEDS/>
<STAIRCASE/>
<STAIRBOUGHT/>
@ -88,12 +88,6 @@
<FIRSTSTAIR/>
<NUMSTAIR/>
<MRENTPRESTAIRCASING/>
<SEXRAB1>F</SEXRAB1>
<SEXRAB2/>
<SEXRAB3>F</SEXRAB3>
<SEXRAB4/>
<SEXRAB5>M</SEXRAB5>
<SEXRAB6/>
<BUILDHEIGHTCLASS>2</BUILDHEIGHTCLASS>
<DAY>1</DAY>
<MONTH>4</MONTH>

10
spec/services/exports/sales_log_export_service_spec.rb

@ -333,7 +333,7 @@ RSpec.describe Exports::SalesLogExportService do
end
end
context "when exporting only 24/25 collection period" do
context "when exporting only 24/25 collection period", metadata: { year: 24 } do
let(:start_time) { Time.zone.local(2024, 4, 3) }
before do
@ -365,8 +365,8 @@ RSpec.describe Exports::SalesLogExportService do
end
end
context "when exporting only 25/26 collection period" do
let(:start_time) { Time.zone.local(2025, 4, 1) }
context "when exporting only 25/26 collection period", metadata: { year: 25 } do
let(:start_time) { collection_start_date_for_year(2025) }
before do
Timecop.freeze(start_time)
@ -397,8 +397,8 @@ RSpec.describe Exports::SalesLogExportService do
end
end
context "when exporting only 26/27 collection period" do
let(:start_time) { Time.zone.local(2026, 4, 1) }
context "when exporting only 26/27 collection period", metadata: { year: 26 } do
let(:start_time) { collection_start_date_for_year(2026) }
before do
Timecop.freeze(start_time)

Loading…
Cancel
Save