* feat: add void date guidance partial
* feat: set guidance pos bottom for 22/23 log
* feat: add tests
* refactor: linting
* Update app/models/form/question.rb
Co-authored-by: Phil Lee <asmega@users.noreply.github.com>
* feat: smart quotes
* feat: respond to po comments
* feat: add voiddate/mrcdate validation to mrcdate too
* feat: add ten year validations to startdate too
* feat: fix tests
---------
Co-authored-by: Phil Lee <asmega@users.noreply.github.com>
* Clear import fields failing non_temp_accommodation validation
* Clear joint tenancy if there is only 1 person in the household
* Clear offered if the value is above the maximum of 20
* Display error message on ecstat
* Remove ecstat if the income is too high for it
* Update service charge validations
* Create location deactivation periods instead of setting a scheme end date
* Add test for deactivation period
* Update ranges in tests
* Remove scheme validation test
* Check that the location gets confirmed
---------
Co-authored-by: Kat <katrina@kosiak.co.uk>
* Remove failing equity over max on import
* Remove failing equity under min on import
* Use LA instead of postcode if postcode is in invalid format
* Do not backfill information about people indexed 7 and higher
* Unskip test
* add method to sales log and use in depends on to increase readability
* increase minimum allowed value for mortgage
* write tests and add validation error to config for new validation
* write validation
* adjust validation so it doesn't trigger when mortgage value is derived as 0
* correct linting problem and update tests to account for change in validation
* 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
* Do not run discounted ownership validation if mortgageused is don't know
* Clear previuos postcode if import hits postcodes_not_matching error
* Remove child income validation for 22/23
* Remove invalid exchange date
* Clear income 1 if it's over allowed non london threshold
* feat: add validation that staircase % is >= threshold
* refactor: dry out validation
* refactor: correctly order shared ownership types in array
* test: add tests for stairbought threshold validation
* chore: lint
* feat: all staircasing transactions must have stairbought >= 1%
* feat: add validation to shared ownership type as well
* chore: lint
* refactor: simplify no errors tests
* refactor: simplify tests by using iteration
- This validation is new to this service. The old CORE did not do it.
- A decision was decided to move this to a soft validation in CLDC-2074
- As a temporary fix to allow us to migrate values that are currently incompatible with our validation, we will relax this constraint.
This covers the following errors:
- Where the income is 0, set earnings and income to blank and set incref to refused
- Removing invalid tenancylength and tenancy values where tenancylength is invalid
- Removing prevten and age1 where incompatible
* 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>
* feat: add sales validation to check bedsits have <=1 beds
* test: sales validation to check bedsits have <=1 beds
* fix: typo in property validation method name
* feat: add same bedsit validation to number of bedrooms question
* test: fix typo propert -> property in property validations tests
* test: add test for validate_property_number_of_bedrooms (sales)
* feat: update wording for 'number of bedrooms' validation when bedsit
* test: condense sales property validations tests
* test: strengthen sales property validations error addition test
* refactor: simplify sales property validations into one method
* fix: update error message content to match Beth's choices
* chore: lint
* test: add requests test for invalid sales log params when posting
* refactor: use if rather than unless... not in property validation
* refactor: write method is_bedsit? on SalesLog
* test: check bedsit error not added if proptype or beds is nil
* lint: use update! not update
* feat: update validation messages to improve readability
* fix: provide valid date in request test for invalid proptype/beds
* feat: make is_bedsit and validate_bedsit_number_of_beds more readable
* Add next years form to the form handler
* Disable collection window validation in non prod/test
* fix the years in the correct file
* Undo year bulk upload change
* 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
* initialise missing forms using the new format, disable 14 days validation on non production
* Use only current and previous forms where needed
* refactor
* Refactor
* Remove startdate collection window validation from non production
* 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
* replace range validation with multiple to account for single-ended ranges
* add test for question with min but no max
* add min and max to household count question and remove bespoke validation. Remove code allowing max and no min given this situation does not seem to exist int eh form
* amend minor typo, add back a soft validation that had mysteriously gone missing
* Add mortgage value check after mortgage used and mortgage amount pages
* Run the mortgage amount validation on non joint purchases as well
* Add validation to disounted and outright sales
* only show buyer 2 checks if it's a jjoint purchase
* 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
* change percent to % so that suffix is consistent with other similar questions
* fix rebase conflicts
* add hard validation that percentage owned after a staircasing transaction cannot be less than the percentage bought in that transaction, with associated tests
* add compound validation to ensure that logs of type older person shared ownership may not have a stairbought value of greater than 75% \n associated tests included
* remove duplicate method and use existing version
* fix rebase conflicts
* ensure schema correct and test of page number correct
* fix form handler test after rebase
* fix tests and ensure schema correct after rebase
* 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
* 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
* fix rebase conflicts
* fix rebase conflicts
* fix rebase conflicts
* implement soft validation of grant value
* fix rebase conflicts
* fix rebase conflicts
* fix rebase conflicts
* fix rebase conflicts
* fix final test from added page
* update test after rebase
* Add min and max for age 1 validation
* Add retirement value check column to the sales table
* Add retirement value check question and page
* Add retirement value check pages to household characteristics
* Reuse soft validations for retirement in sales
* Update person_indexes
* Add old_persons_shared_ownership validation
* Display the retirement value check in correct places depending on the joinpur value
* Update page IDs
* It's always joint purchase if age 2 is displayed
* lint
* lint