* 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
* 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
* Empty
* CLDC-3345 Rename created_by to assigned_to (#2372)
* Rename created_by to assigned_to
* Replace created_by with assigned_to
* Update created_by to assigned_to in exports, remove blank assigned to
* CLDC-3345 Add and set created_by fields (#2373)
* Add created_by
* Update existing created_by values
* Set created_by on single log
* Set created_by on BU
* Add created_by to exports
* feat: update since last merge
---------
Co-authored-by: natdeanlewissoftwire <nat.dean-lewis@softwire.com>
* Fix papertrail create version
---------
Co-authored-by: natdeanlewissoftwire <nat.dean-lewis@softwire.com>
* Empty commit
* CLDC-3224: Parse noint correctly in bulk upload row parsers
* CLDC-3224: Add task to fix previous noint data
* CLDC-3224: Remove nonsensical value for noint field in bu test
* CLDC-3224: Move where bulk upload noint fix status is set to ensure it matches processing version
* Put BU noint_fix_status setting before creating any logs
* Blank commit for replication
* CLDC-3210: Check for R properly for sales BU savings field
* Sort refused check for income fields
* Add tests
* Allow any number of digits
* Correctly route to sales owning organisation page
* Display correct owning organisation options
* Set managing organisation as user organisation
* Add managing organisation question for sales
* Display managing organisation users in created_by
* set managing org to be same as owning org in BU
* Add managed by filter to sales
* Display reported by, correctly update owning org
* Update factory and 2022 BU
* refactor
* Merge managed sales logs
* test
* Update managing organisation for sales bulk upload
* Rebase tests
* skip a test as it is not relevant as the rake task would have already been ran
* PO fixes
* Remove old collection managed sales validation
* Update question header and filters conditions
* remove feature toggle
* feat: only show editable duplicate sets for user and org
* feat: simplify and refactor
* feat: update tests
* feat: add and update tests
* feat: reset not routed questions twice to catch newly not routed questions after the first set are cleared
* Revert "feat: reset not routed questions twice to catch newly not routed questions after the first set are cleared"
This reverts commit 3007284670.
* TEST FOR PO TO BE REVERTED
* TEST FOR PO TO BE REVERTED (set back to dec 31)
* TEST UPDATE TESTS
* REVERT THIS TEST UPDATE
* REVERT THIS TEST UPDATE
* feat: timecop tests
* refactor: lint
* feat: add update methods
* feat: update tests (and TO BE REVERTED: change collection year)
* feat: update tests
* feat: update tests
* feat: update form end_date tests REVERT LATER
* feat: update tests
* refactor: lint
* feat: revert to previous end dates now passed PO review
* feat: use scoping to simplify editable set logic
* feat: match email regardless of casing in bulk upload
* feat: allow null emails
* feat: set encoding by bom for file IO before parsing
* Revert "feat: set encoding by bom for file IO before parsing"
This reverts commit 03d2d17e7b.
* feat: wip update sales org select
* feat: update routing and hidden in check answers methods
* feat: set sales org id as derived
* feat: update tests
* refactor: linting
* feat: update tests and radio options
* feat: update test
* feat: add value helper test for non-constant value question
* refactor: lint
* feat: freeze time in unrelated test
* refactor: linting
* feat: setup to replicate failures to fix
* feat: wip test fixes
* feat: remainder of current state test fixes
* feat: set form date to past to trigger errors to fix
* feat: revert, don't want this in final diff
* feat: fix row_parser tests
* feat: sales log importer and validator fixes
* feat: remainder of test fixes
* refactor: lint
# Context
- https://digital.dclg.gov.uk/jira/browse/CLDC-2305
- This is rework to add missing validations for sales setup fields for bulk upload
# Changes
- There is code that clears log fields if they are not a valid option. in order to generate errors for these we check certain fields for content prior to `log.valid?` being called. Unfortunately there does not appear to be an easy way to access to valid options therefore these values have been hard coded
- Privacy notice must be accepted other considered a setup error
- The `type` question can actually be one of three questions with the same identifier. these are excluded as part of `validate_valid_radio_option` and instead validated with a different mechanism. The rationale being that `log.valid?` will clear data before we get there
- Remove tests associated to upload threshold which are no longer required
* Do not allow 32 as an option for 22/23 sale type
* Correctly block log creation
* refactor test
* lint
* Add error to the correct field
* Add error as part of validating radio options
* Update row parser null check
* add a bespoke validation to the row parser
when buyer 1 is uploaded with working situation child, this should be validated with a custom message.
a test for this case was also created
* replicate the work from the last commit for the 2023 row parser and associated test file
* lint correction remove blank lines
# Context
- https://digital.dclg.gov.uk/jira/browse/CLDC-2316
- Implement bulk upload sales for new collection year 2023
- This is a first pass implementation and will probably have some bugs in it and we can address over time
# Changes
- Add CSV parser for sales 2023 to handle CSV structure
- Tweak collection window validation so error now contextual to year selected for upload
- Handle arbitrary ordering of CSV columns
- Fix ordering of errors in report and now ordered by cell
- Added `Upload your file again` link styled as button on error report to match lettings experience
- Update tooling to convert logs to 2023 csv rows with support for random column ordering
# Known issues
- There seem to be some issues with how UPRN is handled if the UPRN cannot be validated.
- For the above I think there is dependency on https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data/pull/1570 which should clear any errored fields so users can continue to create logs and fix within the service