CLDC-1633 build feature csv download of sales logs (#1568)
* create a method on the FormHandler that returns the sales form questions for all years in the order that they appear in the form
* update csv email job to accomodate sales log export as well as lettings
add to tests to reflec the changes made
* write tests to cover the desired functionality of the SalesLogCsvService
* create the SalesLogCsvService
create a necessary method on the log to enable submission method to be included on the csv
derive values for the two halves of previous postcode for export
* add relevant links in the UI and pipe everything together in controllers
amend organisations controller to have flexibility to download logs of either type
add necessary methods to sales log controller, raising shared method to logs controller
update routing for amendments and additions
extract helper method to build urls for downloading logs within an organisation
* correct various linter complaints and tech review suggestions
* minor amendment to add old_id and reorder early columns
* undo my 'clever' refactor that broke things
* refactoring of csv service after some tech review and some UI testing in review app
* update tests to include a test of a full export and all values in teh csv
* correct minor routing error to ensure correct url is shown and tab selected after requesting csv email
* update organisations controller requests spec file to cover new functionality and make a minor amendment to authentication scope in the controller after error found in testing
* write request tests for the new functionality in the sales log controller, define authorisation in the controller
* minor correction after rubocop's kind suggestion'
* various corrections from first pass at PO, tech review, linter, etc
* refactor :ordered_sales_questions_for_all_years
* first pass at implementing flexible code-based form fixtures for testing
* second pass
* refactor all tests of :ordered_sales_questions_for_all_years to use new factories
* some refactoring in the testing of the csv service
* use that fact that params is always available in controllers and don't pass it around, inline some methods calls
* correct minor bug to ensure that "Return to logs" link returns to the correct index page
* remove reminder comments
* write further tests on the manipulation of questions into the csv headers, update factories of form constituents to allow the creation of forms with richer questions
* fix linter complaints
* minor alterations after rebase to account for changes made on other branches
* refactor after code review
* tweak fixtures after rebase containing alterations to the factory defaults
,completed,2023-02-08T16:52:15+00:00,2023-02-08T16:52:15+00:00,,2022,single log,false,DLUHC,Danny Rojas,2,2,2023,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,2,Flat or maisonette,Purpose built,Yes,,,,,,,SW1A,1AA,Yes,E09000003,Barnet,Yes,Yes,1,30,Non-binary,Buyer 1 prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,,,,Full-time - 30 hours or more,Yes,1,Child,14,Non-binary,Child under 16,Other,18,Non-binary,"In government training into work, such as New Deal",Person prefers not to say,40,Non-binary,Part-time - Less than 30 hours,Person prefers not to say,40,Non-binary,Full-time - 30 hours or more,Local authority tenant,No,,,No,,,1,1,1,1,,,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,2,10,,,,,,,,,,,,,,,,,110000.0,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,1000.0,,Yes,100.0,,10000.0
1
id
status
created_at
updated_at
old_id
collection_start_year
creation_method
is_dpo
owning_organisation_name
created_by_name
day
month
year
purchid
ownershipsch
type
othtype
companybuy
buylivein
jointpur
jointmore
beds
proptype
builtype
pcodenk
uprn
uprn_confirmed
address_line1
address_line2
town_or_city
county
pcode1
pcode2
la_known
la
la_label
wchair
noint
privacynotice
age1
sex1
ethnic_group
ethnic
national
ecstat1
buy1livein
relat2
age2
sex2
ethnic_group2
ethnicbuy2
nationalbuy2
ecstat2
buy2livein
hholdcount
relat3
age3
sex3
ecstat3
relat4
age4
sex4
ecstat4
relat5
age5
sex5
ecstat5
relat6
age6
sex6
ecstat6
prevten
ppcodenk
ppostc1
ppostc2
previous_la_known
prevloc
prevloc_label
pregyrha
pregother
pregla
pregghb
pregblank
buy2living
prevtenbuy2
hhregres
hhregresstill
armedforcesspouse
disabled
wheel
income1nk
income1
inc1mort
income2nk
income2
inc2mort
hb
savingsnk
savings
prevown
prevshared
proplen
staircase
stairbought
stairowned
staircasesale
resale
exday
exmonth
exyear
hoday
homonth
hoyear
lanomagr
soctenant
frombeds
fromprop
socprevten
value
equity
mortgageused
mortgage
mortgagelender
mortgagelenderother
mortlen
extrabor
deposit
cashdis
mrent
has_mscharge
mscharge
discount
grant
2
completed
2023-02-08T16:52:15+00:00
2023-02-08T16:52:15+00:00
2022
single log
false
DLUHC
Danny Rojas
2
2
2023
Yes - a discounted ownership scheme
Right to Acquire (RTA)
Yes
Yes
2
Flat or maisonette
Purpose built
Yes
SW1A
1AA
Yes
E09000003
Barnet
Yes
Yes
1
30
Non-binary
Buyer 1 prefers not to say
17
United Kingdom
Full-time - 30 hours or more
Yes
Partner
35
Non-binary
Full-time - 30 hours or more
Yes
1
Child
14
Non-binary
Child under 16
Other
18
Non-binary
In government training into work, such as New Deal