* update factory completed traits using an after build hook so that trait does what it says regardless of start or sale date of log
* use completed trait rather than completed2024 trait from factories
skip validation on saving logs from previous years so that logs created too far in the past do not trigger validations
* remove sale and start dates from logs in tests where that should not be important
build rather than create to reduce db interactions
in order that the setup is complete, build the necessary user and organisation with ids
* fix a wide range of tests affected by the changes in log factories completed traits
* initial spec file refactor
remove create for build, extract form to own variable, remove non-valuable tests
run time from 0.29s to0.11s
* refactor to ensure that the questions ownershipsch instance variable and the value of ownershipsch on the log is the same in tests
* delete page test file which is not testing anything meaningful
* add error messages to the I18n yml
* update tests for the validations
* update validation logic
* update tests for the mortgage used question
* update the mortgage used question displayed answer options
* update bulk upload specs to reflect error message updates
* make use of brackets consistent within validation method
* CLDC-3487: Clear previous_la_known when necessary for renewal logs
* CLDC-3487: Clear location when clearing scheme due to org change
* CLDC-3487: Use nil instead of 0
* Specify orgs on sh logs when needed for tests
* Fix flaky tests
* ensure in the update method that it is not possible to delete rent periods that are in use by that organisation
* lint
---------
Co-authored-by: Kat <katrina@kosiak.co.uk>
* CLDC-3463: Fix bug with vacdays calculation
* CLDC-3463: Fix lettings csv export tests
* Lint
* Use build_stubbed where necessary for lettings logs in tests
* Update all logs in rake task but without validation
* Try validations in rake tasks and log when needing to skip them
* 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
* 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
* create presenter class to hold all the db calls and data for showing the home page
plus tests, some changes to factoreis and helpers necessary
this should avoid an overly bloated controller method or calling the DB from a view helper
* view partial changes
to accommodate design changes, decouple box with counter and blue link boxes
since various boxes show or not or in a different order depending on whether the org logs sales and whether we are in the crossover period I have also made grid and row partials to improve readability on the index page.
* redesign the home page using the new presenter and partials, deliver the presenter object to the view from the controller
* adjust tests and factories and address api call stub
* remove view helpers that are no longer being used and remove outdated tests for home page
* amend presenter and associated calls from view, tests, to ensure support user always sees sales data
* write request specs for the homepage
* undo unnecessary change to factory
* make corrections following rebase conflicts
* various minor changes following tech review
* logs assigned to a provider should be vivisble to them in the homepage count rather than logs created by them
* resolve rebase confusion in csv fixture files
* 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