* Add archived forms to the form handler
* Remove archived form if the year after it is no longer editable
* Filter logs list by existing forms only
* Add archived_lettings if it's not defined in json
* Rebase changes
* Fix unrelated test
* create helper module to find all logs for a given user that have duplicates
write associated tests
update methods on user model to retrieve logs related to a given user
create a scope on logs to retrieve logs created by a given user
* check for duplicates and display notification banner on the index page where appropriate
tests to cover the desired behaviour
* alter duplicate logs helper to return duplicates in a format that can be passed through the params
update associated tests
* create user journey to view duplicate sets adn navigate to a given set
create a new route and add it to the link from the logs index page
create controller method and related view file
* update path for duplicate logs in routes, update factories, refactor duplicates scope to eliminate raw sql
* write tests for the duplicate logs index page
* correct linting errors
* minor amendments from code review.
* temp
* Refactor
* Create a scope for duplicate groups
* fixes
* lint
* Update controller specs
* Put duplicate sets count behind a feature flag
* refactor index
* Update duplicate_sets_count
* Update scopes
* tests
* pass in original log id
* tests
* Add duplicate index page content
---------
Co-authored-by: Kat <katrina@kosiak.co.uk>
* Update check answers to use the correct logs
* Display different link when correcting duplicates
* allow deduplicating logs by changing the answers
* Route back to the initial log if it still has duplicates
* Update back to log button
* Add banner
* Update success banner
* Fix a flaky test
* Rename param and update conditionals
* Add owning organisation to deduplication fields, only return back to the original log if it still belongs to the org
* CLDC-2494: WIP
* CLDC-2494: wip
* CLDC-2494: page work in progress
* cleanup
* Add a path for duplicate logs
* Display all duplicate logs
* Move a test
* Display duplicate check answers for logs
* Add buttons to delete duplicates
* Add a route for sales logs duplicates
* Update duplicated page to work for sales logs
* Update styling
* lint
* Add auth
* Rebase updates
* Remove propcode from dedulication checks
* Update fields to work with supported housing
* Trigger duplicate log check on buyer 1 age not known
* compare correct charges
* Update displayed questions
* BU test
* Put redirect to duplicate logs path behind a feature flag
* More BU tests
---------
Co-authored-by: Kat <katrina@kosiak.co.uk>
* Renme end_date to new_logs_end_date
* Display change buttons in CYA if the collection is still open for editing
* Allow navigating to question if the collection is still open for editing
* Allow logs to be edited if the date is before edit end date
* Update sales validation to allow editing existing logs
* update tests
* Update edit_end_date
* Update some test wording
* Update new logs end date
* tests
* 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
* Remove soft validations from sales setup and make them mandatory
* Remove soft validations from lettings setup and make them mandatory
* Fix remaining tests
* Add card numbers to pregnancy checks
* call form to reset invalid values when saving a sales log
* fix tests failing after updating sales log functionality to reset invalid answers
* add a test to cover the new functionality added
* a further test
* add several methods to the sales log to allow subsequent work to be human readable
* add a validation to prevent an inconsistent combination of values and tests for this validation
* handle derivation of values around buyers living in the property
- derive values where appropriate
- clear these values when the derived state no longer holds
- update the routing for pages holding questions about whether particular buyers will live in the property to reflect when they are derived
- test the deriving and associated clearing of values
- update tests on page routing and sales log factory
* update a page routing condition for human readability using an existing method and update test to reflect this change
* show related method in diff
* minor amendments after tech review
* simplify reset_derived_questions after tech review
* refactor on deriving and clearing invalid derived values on sales log
* correct linter complaints
* remove comment
* add validation to one more field with a new error message as it is in fact possible to tirgger the validation in the setup section
* rename variables in test file
* write tests for new validations
* validate that answers to numeric questions are given to the correct level of accuracy and in normal format with only digits
* add error messages for new validations
* add or alter step on numeric questions in sales, amend one test given step changes
* copy change
* remove validation that is specific to number format and fold that functionality into accuracy validation, rejig tests accordingly
* fix various tests
* remove reference to currency in validation message that concerns step only and doesn't check whether firled is currency related
* alter copy to avoid redundant repetition in validaiton message
* save changes made in rebase
* changes after PO review
two step values had been missed in previous work
in various places there were custom validations applied that duplicated the functionality of the generic min max validation that is applied to all numeric questions, in these situations sometimes the min and max on the question class was inconsistent with the limit that triggered validations
these have been corrected and made consistent
various tests were affected by this and have been amended accordingly
* remove tests introduced by mistake in rebase
* amend step value on earnings
* write tests that invalid answers are cleared when the start date of a log is changed
* clear invalid answers when the start date of a log is changed
* correct error
* undo previous work to take new direction
* write tests to cover updated functionality of method in form to reset values when they are not routed to or when answers to radio questions are no longer valid
* update method in form to improve readability and to ensure that when the answers to radio questions are no longer valid, taht they are cleared
* add back an "end" deleted by mistake and fix a linting issue
* make some minor copy and variable name corrections
* fix a broken test after updates
* remove bulk upload tests for adding validations to unpermitted values to radio questions, these are now being cleared before validation
* fix some tests broken after rebasing
* add step to age questions in sales
* remove list of question ids from the form that should not be cleared, this information should be held on the questions themselves
* rename variables
* rename instance variable to be nice and long
* minor changes after rebase
* Set uprn_known to 1 when setting UPRN
* Move fake to dev+test gemfile block
So that we can use factories in local
* Move UPRN known and UPRN questions to single UPRN page
* rename variables in test file
* write tests for new validations
* validate that answers to numeric questions are given to the correct level of accuracy and in normal format with only digits
* add error messages for new validations
* add or alter step on numeric questions in sales, amend one test given step changes
* copy change
* remove validation that is specific to number format and fold that functionality into accuracy validation, rejig tests accordingly
* fix various tests
* remove reference to currency in validation message that concerns step only and doesn't check whether firled is currency related
* alter copy to avoid redundant repetition in validaiton message
* save changes made in rebase
* changes after PO review
two step values had been missed in previous work
in various places there were custom validations applied that duplicated the functionality of the generic min max validation that is applied to all numeric questions, in these situations sometimes the min and max on the question class was inconsistent with the limit that triggered validations
these have been corrected and made consistent
various tests were affected by this and have been amended accordingly
* remove tests introduced by mistake in rebase
* Allow interruption screens to format money values
* Remove formatting from saleslog method
* Use money flag
* Use pre exhisting method to format values
* Update config/locales/en.yml
Co-authored-by: Arthur Campbell <51094020+arfacamble@users.noreply.github.com>
---------
Co-authored-by: Arthur Campbell <51094020+arfacamble@users.noreply.github.com>
* Format errors on money amounts with 2 decimals
* CLDC-1975 Format money input and error messages
* format discounted_ownership_value
* Format more locales
* Update lettings_log tests
* Fix import service spec
* Fix possible bulk upload years
* Initialise 2021/22 form routes for tests
* Return test routes from form handler
* Fix some tests
* fix bulk upload tests
- change from mocks to actual code calls
* update years for bulk upload form
* Fix some uprn tests
* Set the scheme as available from previous year if the collection is in crossover
* Update location available_from
* Update location and scheme tests
* Refactor and comment out a scheme test
* Some uprn and export tests
* Fix lettings logs controller tests and comment out previous collection message test
* fix tests for new collection year
* fix bulk upload tests
for some reason tenancylength must not be given for validation to pass
* update bulk upload tests for new year
* More fixes
* Undo location changes
* Fix remaining uprn
* further new collection year test fixes
---------
Co-authored-by: Phil Lee <asmega@users.noreply.github.com>
* Set default hhregresstill
* Don't clear type if it errors
* Make mortgagelender mandatory and add a don't know option
* Infer mortgagelender as don't know by default
* Add discounted_sale_value_check to sales
* Add DiscountedSaleValueCheck pages and questions
* Add value check to the form
* Only run validate_discounted_ownership_value as a hard validation on and after 24/25
* Rebase fix
* Fix form spec
* Update discounted_ownership_value_invalid?
* update validation
* Update soft validation content
* PR comments
* typo
* lint
* Default discounted_sale_value_check on import
* Make mortlen optional for 22/23
* Set extrabor to don't know it is not answered
* Make mortgage lender and othtype optional
* Add hidden don't know options to soctenant and fromprop
* Make frombeds optional
* Display soctenant questions if soctenant is don't know
* infer soctenant values if not given
* Add local authority links
* Display all local authorities for location
* set correct LA for log based on year
* Format local authorities for locations
* Rename variable
* Add import task for la links
* look at form start date because log start date might not be given
* Update app/models/lettings_log.rb
Co-authored-by: James Rose <james@jbpr.net>
* Update app/helpers/locations_helper.rb
Co-authored-by: James Rose <james@jbpr.net>
* Refactor
* Seed review app
* Change dates format
* Update the local authority link data
* Typo
* update mapping in Lettings logs
---------
Co-authored-by: James Rose <james@jbpr.net>
* feat: correctly infer las for 22/23 logs
* feat: copy changes to sales log
* feat: don't reset las when clash with postcode to make tests pass
* feat: align with similar PR for 23/24
* feat: tidying and add test
* refactor: lint
* refactor: use unless
* CLDC-853 Added hard validations for sales income2
* CLDC-853 Added soft validation for sales income2
* CLDC-853 Fix tests broken by new code
* CLDC-853 Add new tests for new page and refactor slightly
* CLDC-853 Fix linting errors
* CLDC-853 Rename migration and update schema version
* CLDC-853 Fix broken sales income2 test
* CLDC-853 Rename migration
* CLDC-853 Move income 2 to cya card 2 and commonise combined income validation
* CLDC-853 Actually use the validate_combined_income method
* combine duplicate methods after rebase, ensure hard validations are triggered on all relevant fields
* move validation on child income to financial validations to stop it being triggered on lettings logs, minor amendments to tests broken by changes
* revamp financial validations tests against income to reflect updates
* amend child income validation to reflect specifications and write tests to cover this validation
* correct linting errors and play a little code golf
* change copy for some validations, add sales log method and amend interruption screen helper to support this
* extract duplicate code to private method
* update buyer 1 and 2 income value check to be consistent
* remove ecstat from income checks, the only ecstat we care about is child which is dealt with elsewhere
* rename constant struct with same anme as existing variable
* amend tests to reflect the chagnes in validations and copy
* enable currency formatting of numbers for inserting into informative_text or title_text
* update evil test in form handler spec
* rebase and fix conflicts and tests
* change a variable name and correct minor rebase errors
* update interruption screen helper tests
* correct linting errors, minor test failure and typo
* add tests for new sales log method for formatting currency
* fix merge conflicts
---------
Co-authored-by: Arthur Campbell <arfa.camble@gmail.com>
* Update datails known numbering in the db
* Update check answers card headers
* Display same person pges for joint and non-joint purchase
* Only display person questions once
* Remove unused person class and methods
* Always display person known pages and update headers
* Fix depends on, show retirement validation for buyer 2
* test
* Add person 5 to test
* fix context description
* Display person known question for appropriate number of other household members
* tests
* update test
* Remove page id stubbing
* Remove redundant tests
* only put validation on the pages that are routed to
* Refactor tests
* feat: add 22/23 year validation
* feat: wip commit
* feat: update i18n
* feat: add one year gap exchange/completion validations
* tests: add tests for new validations
* test: add setup validations tests
* test: update factory to pass saledate validation
* feat: update seeds
* feat: update tests to reflect sales logs shouldn't exist in new service before 2022
* feat: merge with main, improve date behaviour
* refactor: cleanup
* feat: update tests
* feat: enforce saledate not after 22/23 collection year end
* feat: check date is valid
* feat: add hodate/saledate hard validation to saledate as well
* feat: add HandoverDate check to saledate question
* test: update
* db: update
* test: update
* feat: wip po updates
* feat: add soft_validation to setup
* feat: fix bug by making sale date soft validation optional
* feat: add tests
* test: update
* refactor: linting
* Add monthly_charges_value_check field to sales
* Add monthly_charges_over_soft_max soft validation
* Add monthly_charges_value_check page and question
* Add monthly_charges_value_check pages to the relevant subsections
* Fix optional field name, add validation message
* test
* fix rebase conflicts
* fix rebase conflicts
* feat: update validation
* fix rebase conflicts
* fix rebase conflicts
* test: update
* fix rebase conflicts
* fix rebase conflicts
* fix rebase conflicts
* fix rebase conflicts
* fix rebase conflicts
* implement before validation check to ensure that if the user declares no mortgage will be used, mortgage value is set to 0
* fix rebase conflicts
* fix rebase conflicts
* remove comment
* fix rebase conflicts
* Update config/locales/en.yml
Co-authored-by: James Rose <james@jbpr.net>
* alter order of before validation methods on sales log so that derived fields are calculated after invalidated dependent fields are cleared, fix tests broken by this change
* add mortgage to derived variables so that mortgage value is set to 0 if a mortgage is not being used in the sale
* remove hard validation of range for discount question and allow shared validation of numeric questions to handle this case
* amend tests after rebasing
* fix tests after rebasing
* fix test and ensure schema correct after rebase
---------
Co-authored-by: natdeanlewissoftwire <nat.dean-lewis@softwire.com>
Co-authored-by: James Rose <james@jbpr.net>
* Add old_persons_shared_ownership_value_check to sales table
* Move hard validation method to soft validation
* Add old persons shared ownership value check page and question
* Add pages to the household characteristics
* Add soft validation after ownership type
* update a test
* make old_persons_shared_ownership_value_check optional because it's in the setup section
* typo
* Add income error to ownership type and ecstat fields
* Add shared_ownership_deposit_value_check field
* Add shared_ownership_deposit_invalid? soft validation
* Add shared ownership deposit check pages and questions
* Add pages to the subsection and update validation message
* tests
* Update validation to only trigger if la is given
* Run the soft validation when mortgage isn't used or cash discount isn't given
* test
* Add derived household fields
* Derive household variables for sales logs
* Refactor and fix wrong test names
* Count everyone under 20 as children if relationship is "C"
* Add postcode fields
* Add postcode page and questions
* Add postcode page to the property information subsection
* Only display local authority question if the la is not inferred
* Fix migration
* Move postcode validation
* Infer LA fields from postcode
* infer partial postcodes