Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

341 lines
12 KiB

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
2 years ago
require "rails_helper"
RSpec.describe Csv::SalesLogCsvService do
let(:form_handler_mock) { instance_double(FormHandler) }
let(:organisation) { create(:organisation) }
let(:fixed_time) { now }
let(:now) { Time.zone.now }
let(:user) { create(:user, :support, email: "billyboy@eyeKLAUD.com") }
let(:log) do
create(
:sales_log,
:completed,
assigned_to: user,
saledate: fixed_time,
created_at: fixed_time,
updated_at: now,
owning_organisation: organisation,
purchid: nil,
hholdcount: 3,
age4_known: 1,
details_known_5: 2,
age6_known: nil,
age6: nil,
ecstat6: nil,
relat6: nil,
sex6: nil,
address_line1_as_entered: "address line 1 as entered",
address_line2_as_entered: "address line 2 as entered",
town_or_city_as_entered: "town or city as entered",
county_as_entered: "county as entered",
postcode_full_as_entered: "AB1 2CD",
la_as_entered: "la as entered",
hhregres: 1,
hhregresstill: 4,
)
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:service) { described_class.new(user:, export_type: "labels", year:) }
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
2 years ago
let(:csv) { CSV.parse(service.prepare_csv(SalesLog.all)) }
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:year) { 2024 }
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
2 years ago
before do
Timecop.freeze(now)
Singleton.__init__(FormHandler)
log
end
after do
Timecop.return
end
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
2 years ago
it "returns a string" do
result = service.prepare_csv(SalesLog.all)
expect(result).to be_a String
end
it "returns a csv with headers" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
expect(csv.first.first).to eq "ID"
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
2 years ago
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
context "when stubbing :ordered_questions_for_year" do
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
2 years ago
let(:sales_form) do
FormFactory.new(year: 1936, type: "sales")
.with_sections([build(:section, :with_questions, question_ids:, questions:)])
.build
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:question_ids) { [] }
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
2 years ago
let(:questions) { nil }
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:year) { 1936 }
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
2 years ago
before do
allow(FormHandler).to receive(:instance).and_return(form_handler_mock)
allow(form_handler_mock).to receive(:form_name_from_start_year)
allow(form_handler_mock).to receive(:get_form).and_return(sales_form)
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
allow(form_handler_mock).to receive(:ordered_questions_for_year).and_return(sales_form.questions)
end
it "calls the form handler to get all questions in order when initialized" do
allow(FormHandler).to receive(:instance).and_return(form_handler_mock)
allow(form_handler_mock).to receive(:ordered_questions_for_year).and_return([])
service
expect(form_handler_mock).to have_received(:ordered_questions_for_year).with(1936, "sales")
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
2 years ago
end
context "when it returns questions with particular ids" do
let(:question_ids) { %w[type age1 buy1livein exdate] }
it "includes log attributes related to questions to the headers" do
headers = csv.first
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
expect(headers).to include(*%w[TYPE AGE1 LIVEINBUYER1])
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
2 years ago
end
it "removes some log attributes related to questions from the headers and replaces them with their derived values in the correct order" do
headers = csv.first
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
expect(headers).not_to include "EXDATE"
expect(headers.last(4)).to eq %w[LIVEINBUYER1 EXDAY EXMONTH EXYEAR]
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
2 years ago
end
end
context "when it returns questions with particular features" do
let(:questions) do
[
build(:question, id: "attribute_value_check", type: "interruption_screen"),
build(:question, id: "something_or_other_known", type: "radio"),
build(:question, id: "whatchamacallit_asked", type: "radio"),
build(:question, id: "ownershipsch"),
build(:question, id: "checkbox_question", type: "checkbox", answer_options: { "pregyrha" => {}, "pregother" => {} }),
build(:question, id: "type"),
]
end
it "does not add questions for checks, whether some other attribute is known or whether something else was asked" do
headers = csv.first
expect(headers).not_to include "attribute_value_check"
expect(headers).not_to include "something_or_other_known"
expect(headers).not_to include "whatchamacallit_asked"
end
it "does not add the id of checkbox questions, but adds the related attributes of the log in the correct order" do
headers = csv.first
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
expect(headers.last(4)).to eq %w[OWNERSHIP PREGYRHA PREGOTHER TYPE]
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
2 years ago
end
end
end
it "includes attributes not related to questions to the headers" do
headers = csv.first
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
expect(headers).to include(*%w[ID STATUS CREATEDDATE UPLOADDATE])
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
2 years ago
end
it "returns a csv with the correct number of logs" do
create_list(:sales_log, 15)
log_count = SalesLog.count
expected_row_count_with_headers = log_count + 1
expect(csv.size).to be expected_row_count_with_headers
end
context "when exporting with human readable labels" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:year) { 2023 }
let(:fixed_time) { Time.zone.local(2023, 12, 8) }
let(:now) { fixed_time }
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
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
2 years ago
it "gives answers to radio questions as their labels" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
national_column_index = csv.first.index("NATIONAL")
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
2 years ago
national_value = csv.second[national_column_index]
expect(national_value).to eq "United Kingdom"
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
relat2_column_index = csv.first.index("RELAT2")
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
2 years ago
relat2_value = csv.second[relat2_column_index]
expect(relat2_value).to eq "Partner"
end
it "gives answers to free input questions as the user input" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
age1_column_index = csv.first.index("AGE1")
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
2 years ago
age1_value = csv.second[age1_column_index]
expect(age1_value).to eq 30.to_s
postcode_part1, postcode_part2 = log.postcode_full.split
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
postcode_part1_column_index = csv.first.index("PCODE1")
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
2 years ago
postcode_part1_value = csv.second[postcode_part1_column_index]
expect(postcode_part1_value).to eq postcode_part1
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
postcode_part2_column_index = csv.first.index("PCODE2")
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
2 years ago
postcode_part2_value = csv.second[postcode_part2_column_index]
expect(postcode_part2_value).to eq postcode_part2
end
it "exports the code for the local authority under the heading 'la'" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
la_column_index = csv.first.index("LA")
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
2 years ago
la_value = csv.second[la_column_index]
Cldc 3114 enable support control of rent periods per organisation (#2442) * write helper method to support having the correct rent period checkboxes checked * update new and create in organisations controller and view to enable creation of relevant organisation rent periods write tests for this * small changes to models * enable editing rent period in the UI display change button on org details page display rent periods question on edit page * enable updating org rent periods update logic in #update related tests * alter redirect after support user creates an organisation * adjust various UI elements: ordering of rows, copy changes, label size and associated tests * rework the #rent_period_labels method to return All under the correct conditions, rework tests related to that. + fix assorted tests that were either flakey or breaking due to addition of rent periods logic to create and update * amend failing tests and resolve linting complaints * changes following review * disable checkboxes for rent periods if they are in use so that users are not able to make existing logs invalid hint text added to the question to explain this I have also added all rent periods to a hidden field to remove the need to fetch them again form the db in the update method * update validation to reflect the fact that an org having no associated rent periods no longer means they accept all rent periods update tests adding both cases and removing unnecessary additional db additions * rake task to create rent period associations for orgs that have none * revert mistaken copy changes in designs * create rent periods in factories as default, with an option to skip. skip automatic creation in tests specifically related to rent periods * stub api call for factory value, update csv tests and fixtures accordingly * extract a good chunk of tests out of lettings_log_spec and into a dedicated derived fields spec file. in many cases refactor tests * remove before(:context) and associated patterns. use assign_attributes in various places for cleaner code * escape . in regex for API call stubs to satisfy codeQL remove destroy_all call at the start of a test that was dealing with leftover modesl in the test db * further refactoring of various tests to reduce database interactions and improve speed * remove outdated distinction between unitletas mappings from before 23/24 * remove tests that seem to be testing active record and/or ruby Date class
5 months ago
expect(la_value).to eq "E09000033"
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
2 years ago
end
it "exports the label for the local authority under the heading 'la_label'" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
la_label_column_index = csv.first.index("LANAME")
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
2 years ago
la_label_value = csv.second[la_label_column_index]
Cldc 3114 enable support control of rent periods per organisation (#2442) * write helper method to support having the correct rent period checkboxes checked * update new and create in organisations controller and view to enable creation of relevant organisation rent periods write tests for this * small changes to models * enable editing rent period in the UI display change button on org details page display rent periods question on edit page * enable updating org rent periods update logic in #update related tests * alter redirect after support user creates an organisation * adjust various UI elements: ordering of rows, copy changes, label size and associated tests * rework the #rent_period_labels method to return All under the correct conditions, rework tests related to that. + fix assorted tests that were either flakey or breaking due to addition of rent periods logic to create and update * amend failing tests and resolve linting complaints * changes following review * disable checkboxes for rent periods if they are in use so that users are not able to make existing logs invalid hint text added to the question to explain this I have also added all rent periods to a hidden field to remove the need to fetch them again form the db in the update method * update validation to reflect the fact that an org having no associated rent periods no longer means they accept all rent periods update tests adding both cases and removing unnecessary additional db additions * rake task to create rent period associations for orgs that have none * revert mistaken copy changes in designs * create rent periods in factories as default, with an option to skip. skip automatic creation in tests specifically related to rent periods * stub api call for factory value, update csv tests and fixtures accordingly * extract a good chunk of tests out of lettings_log_spec and into a dedicated derived fields spec file. in many cases refactor tests * remove before(:context) and associated patterns. use assign_attributes in various places for cleaner code * escape . in regex for API call stubs to satisfy codeQL remove destroy_all call at the start of a test that was dealing with leftover modesl in the test db * further refactoring of various tests to reduce database interactions and improve speed * remove outdated distinction between unitletas mappings from before 23/24 * remove tests that seem to be testing active record and/or ruby Date class
5 months ago
expect(la_label_value).to eq "Westminster"
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
2 years ago
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
context "when the requested form is 2024" do
let(:now) { Time.zone.local(2024, 5, 1) }
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:year) { 2024 }
let(:fixed_time) { Time.zone.local(2024, 5, 1) }
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
before do
log.update!(nationality_all: 36)
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
it "exports the CSV with the 2024 ordering and all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_labels_24.csv")
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
expect(csv).to eq expected_content
end
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
context "when the requested form is 2023" do
let(:now) { Time.zone.local(2024, 1, 1) }
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:year) { 2023 }
it "exports the CSV with the 2023 ordering and all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_labels_23.csv")
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
end
expect(csv).to eq expected_content
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
2 years ago
end
end
context "when the log has a duplicate log reference" do
before do
log.update!(duplicate_set_id: 12_312)
end
it "exports the id for under the heading 'duplicate_set_id'" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
duplicate_set_id_column_index = csv.first.index("DUPLICATESET")
duplicate_set_id_value = csv.second[duplicate_set_id_column_index]
expect(duplicate_set_id_value).to eq "12312"
end
end
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
2 years ago
end
context "when exporting values as codes" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:service) { described_class.new(user:, export_type: "codes", year:) }
let(:year) { 2023 }
let(:fixed_time) { Time.zone.local(2023, 12, 8) }
let(:now) { fixed_time }
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
2 years ago
it "gives answers to radio questions as their codes" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
national_column_index = csv.first.index("NATIONAL")
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
2 years ago
national_value = csv.second[national_column_index]
expect(national_value).to eq 18.to_s
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
relat2_column_index = csv.first.index("RELAT2")
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
2 years ago
relat2_value = csv.second[relat2_column_index]
expect(relat2_value).to eq "P"
end
it "gives answers to free input questions as the user input" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
age1_column_index = csv.first.index("AGE1")
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
2 years ago
age1_value = csv.second[age1_column_index]
expect(age1_value).to eq 30.to_s
postcode_part1, postcode_part2 = log.postcode_full.split
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
postcode_part1_column_index = csv.first.index("PCODE1")
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
2 years ago
postcode_part1_value = csv.second[postcode_part1_column_index]
expect(postcode_part1_value).to eq postcode_part1
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
postcode_part2_column_index = csv.first.index("PCODE2")
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
2 years ago
postcode_part2_value = csv.second[postcode_part2_column_index]
expect(postcode_part2_value).to eq postcode_part2
end
it "exports the code for the local authority under the heading 'la'" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
la_column_index = csv.first.index("LA")
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
2 years ago
la_value = csv.second[la_column_index]
Cldc 3114 enable support control of rent periods per organisation (#2442) * write helper method to support having the correct rent period checkboxes checked * update new and create in organisations controller and view to enable creation of relevant organisation rent periods write tests for this * small changes to models * enable editing rent period in the UI display change button on org details page display rent periods question on edit page * enable updating org rent periods update logic in #update related tests * alter redirect after support user creates an organisation * adjust various UI elements: ordering of rows, copy changes, label size and associated tests * rework the #rent_period_labels method to return All under the correct conditions, rework tests related to that. + fix assorted tests that were either flakey or breaking due to addition of rent periods logic to create and update * amend failing tests and resolve linting complaints * changes following review * disable checkboxes for rent periods if they are in use so that users are not able to make existing logs invalid hint text added to the question to explain this I have also added all rent periods to a hidden field to remove the need to fetch them again form the db in the update method * update validation to reflect the fact that an org having no associated rent periods no longer means they accept all rent periods update tests adding both cases and removing unnecessary additional db additions * rake task to create rent period associations for orgs that have none * revert mistaken copy changes in designs * create rent periods in factories as default, with an option to skip. skip automatic creation in tests specifically related to rent periods * stub api call for factory value, update csv tests and fixtures accordingly * extract a good chunk of tests out of lettings_log_spec and into a dedicated derived fields spec file. in many cases refactor tests * remove before(:context) and associated patterns. use assign_attributes in various places for cleaner code * escape . in regex for API call stubs to satisfy codeQL remove destroy_all call at the start of a test that was dealing with leftover modesl in the test db * further refactoring of various tests to reduce database interactions and improve speed * remove outdated distinction between unitletas mappings from before 23/24 * remove tests that seem to be testing active record and/or ruby Date class
5 months ago
expect(la_value).to eq "E09000033"
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
2 years ago
end
it "exports the label for the local authority under the heading 'la_label'" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
la_label_column_index = csv.first.index("LANAME")
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
2 years ago
la_label_value = csv.second[la_label_column_index]
Cldc 3114 enable support control of rent periods per organisation (#2442) * write helper method to support having the correct rent period checkboxes checked * update new and create in organisations controller and view to enable creation of relevant organisation rent periods write tests for this * small changes to models * enable editing rent period in the UI display change button on org details page display rent periods question on edit page * enable updating org rent periods update logic in #update related tests * alter redirect after support user creates an organisation * adjust various UI elements: ordering of rows, copy changes, label size and associated tests * rework the #rent_period_labels method to return All under the correct conditions, rework tests related to that. + fix assorted tests that were either flakey or breaking due to addition of rent periods logic to create and update * amend failing tests and resolve linting complaints * changes following review * disable checkboxes for rent periods if they are in use so that users are not able to make existing logs invalid hint text added to the question to explain this I have also added all rent periods to a hidden field to remove the need to fetch them again form the db in the update method * update validation to reflect the fact that an org having no associated rent periods no longer means they accept all rent periods update tests adding both cases and removing unnecessary additional db additions * rake task to create rent period associations for orgs that have none * revert mistaken copy changes in designs * create rent periods in factories as default, with an option to skip. skip automatic creation in tests specifically related to rent periods * stub api call for factory value, update csv tests and fixtures accordingly * extract a good chunk of tests out of lettings_log_spec and into a dedicated derived fields spec file. in many cases refactor tests * remove before(:context) and associated patterns. use assign_attributes in various places for cleaner code * escape . in regex for API call stubs to satisfy codeQL remove destroy_all call at the start of a test that was dealing with leftover modesl in the test db * further refactoring of various tests to reduce database interactions and improve speed * remove outdated distinction between unitletas mappings from before 23/24 * remove tests that seem to be testing active record and/or ruby Date class
5 months ago
expect(la_label_value).to eq "Westminster"
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
2 years ago
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
context "when the requested form is 2024" do
let(:now) { Time.zone.local(2024, 5, 1) }
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:fixed_time) { Time.zone.local(2024, 5, 1) }
let(:year) { 2024 }
it "exports the CSV with all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_codes_24.csv")
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
end
expect(csv).to eq expected_content
end
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
context "when the requested form is 2023" do
let(:now) { Time.zone.local(2024, 1, 1) }
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
let(:year) { 2023 }
it "exports the CSV with all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_codes_23.csv")
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
end
expect(csv).to eq expected_content
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
2 years ago
end
end
context "when the log has a duplicate log reference" do
before do
log.update!(duplicate_set_id: 12_312)
end
it "exports the id for under the heading 'duplicate_set_id'" do
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
duplicate_set_id_column_index = csv.first.index("DUPLICATESET")
duplicate_set_id_value = csv.second[duplicate_set_id_column_index]
expect(duplicate_set_id_value).to eq "12312"
end
end
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
2 years ago
end
CLDC-3438 Update log csv download flow (#2403) * Filter out empty options from selected filters * Redirect to year filter if it is not selected * Add remaining filter questions * Display lettings filters CYA * Add cancel, conditionally display send email * Refactor * Add removed tests * Update method name * Add sales logs filters * Update tests * Set label size on filter questions * Refactor * Deduplicate filter views * Rename methods * Authenticate pages * Update filtering per organisation * Update routing from CYA * lint * Refactor check_your_answers_filters_list * Redirect if year is not given for sales csv * Update formatted organisations methods * Update missing and wrong copy * Update cancel and back buttons * CLDC-3442 Download logs csv per year (#2404) * Specify year in lettings csv download service * Specify year in sales csv download service * Define non_question_fields per year * Tidy up missing fields and tests * Fix request tests * Refactor * Add missing param * CLDC-3348 Update sales CSV for support (#2407) * Update sales csv for support * CLDC-3352 Update sales CSV address order (#2410) * Update sales support csv address ordering * Refactor * CLDC-3367 Rename sales support CSV fields (#2413) * Rename sales support CSV fields * Update sales CSV user fields order (#2416) * CLDC-2586 Rename scheme sensitive (#2405) * Rename scheme sensitive in lettings csv * Rename scheme sensitive in schemes csv * CLDC-3347 Show soft validations in support CSVs only (#2406) * Show soft validations in support csvs only * CLDC-3352 Update lettings CSV address order (#2409) * Update lettings support csv address ordering * Refactor * CLDC-3415/3421/3422 Add lettings CSV updates (#2415) * Add first_time_property_let_as_social_housing to coordinators csv * Update lettings CSV user fields order * Remove new_old from lettings CSV * Remove duplicate rent value check from CSV (#2423) * Refactor CSV service (#2425) * Extract and move lettings methods * Extract and more sales methods
5 months ago
context "when the user is not a support user" do
let(:user) { create(:user, email: "billyboy@eyeklaud.com") }
let(:headers) { csv.first }
it "does not include certain attributes in the headers" do
expect(headers).not_to include(*%w[address_line1_as_entered address_line2_as_entered town_or_city_as_entered county_as_entered postcode_full_as_entered la_as_entered created_by value_value_check monthly_charges_value_check])
end
context "and the requested form is 2024" do
let(:year) { 2024 }
let(:now) { Time.zone.local(2024, 5, 1) }
let(:fixed_time) { Time.zone.local(2024, 5, 1) }
before do
log.update!(nationality_all: 36)
end
context "and exporting with labels" do
let(:export_type) { "labels" }
it "exports the CSV with all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv")
values_to_delete = %w[id]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
end
expect(csv).to eq expected_content
end
end
end
end
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
2 years ago
end