* 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
* ensure copy is changed for both questions relating to how many times a property has been offered
extract to en.yml so that both questions keep identical copy in the future
* minor typo caught in code review
* update copy to handle pluralisation in the case of joint purchase for previous ownership, with associated testing changes
* update copy to handle pluralisation in the case of joint purchase for staircasing, with associated testing changes
* update copy to handle pluralisation in the case of joint purchase for buyer previous, with associated testing changes
* make minor linting changes and update the evil test about number of pages
* potential variation on how to achieve pluralisation
* use built in rails methods of pluralising copy
* 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>
* bulk upload considers housing needs fields
* bulk upload only permits one housing needs type
* add bulk upload validation
- no disabled needs cannot be selected in conjunction with a disabled need
* add bulk upload validation
- dont know disabled needs cannot be selected in conjunction with a disabled need
* add bulk upload validation
- no and don't know disabled access needs cannot be selected together
* 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
* 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
* remove duplicate bulk validations
- validation was being performed both at CSV level and log level causing
a duplicate validation to appear
* bulk upload valiation errors now store the message
- previouly this was storing just the error type which we do not have a
mechanism to pipe these back to user readable error messages
* 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
* Display the correct error for privacy notice and display the partial guidance at the top by default
* Always display privacy notice question
* Disable the rest of the housing characteristics questions until privacynotice is answered
* fix tests
* remove duplicate field
* Display the household questions if the buyers were not interviewed
* 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
* 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 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
* Add min and max to age2 + questions
* validate that under 16s are economic children
* Update factory
* Update test
* Update ecstat, relationship and age validation
* feat: wip postcode page
* feat: wip add new flow
* feat: add check answers page, continue updating flow
* feat: add back behaviour
* feat: more flow work
* feat: further flow work and flash notice, name tidying
* feat: add check_answers referrer linking
* feat: add controller and details linking and lint
* refactor: erblinting
* feat: add local_authority page (currenlty separate from edit_local_authority to avoid conflict with add location to newly created scheme path, to be fixed later). also copy and routing updates
* feat: add validations to controller (could later be added to model)
* fix: correct date order
* feat: validate on model (except startdate)
* feat: copy update
* refactor: railsification
* feat: add date model validation
* feat: add updated availability text in check_answers
* feat: more updated dynamic text and linking
* refactor: erblinting
* refactor: cleanup of redundant code
* refactor: remove redundant create
* feat: use rails route
* test: wip tests
* test: wip tests
* feat: add new back behaviour for new scheme path and tests wip
* feat: add more back behaviour for new scheme path and fix local auth validation
* feat: further linking behaviour with routes and referrers, don't add new location automatically to new schemes
* feat: if location with no details added, route to normal path rather than check answers
* test: update model and helper location tests
* test: more test updates
* test: more test updates and remove redundant files
* test: remove redundant tests, add postcode test
* test: add new #new tests
* test: add test for all new controller methods
* test: add more startdate tests
* refactor: erblinting
* test: fix failing tests
* test: update scheme test
* feat: respond to PR comments
* feat: make postcode clear only if changed
* feat: add _update methods
* refactor: simplify validation and location_edit_path method
* refactor: add helper method for action text
* refactor: remove redundant logic
* refactor: simplify routing
* refactor: reintroduce location_params
* refactor: use presence validation for postcode
* refactor: use presence validation for la
* feat: validate confirmed
* tests: make tests pass with new startdate validation
* WIP
* refactor: simplify display attributes helpers and update tests
* refactor: linting
* feat: design change to save behaviour
* test: fix failing tests
* feat: location code copy tweak
* refactor: remove redundant function
* refactor: remove add_another_location and new location page
* feat: simplify startdate validations to move to model, use scheme available_from date for in range validation
* test: fix failing tests
* refactor: linting
* feat: remove name validation as a result of PO review
* test: update tests
* refactor: remove redundant context
Co-authored-by: James Rose <james@jbpr.net>
* Validate that the user belongs to either the managing or owning organisation
* do not reset created_by and remove user_organisation_chosen?
* Do not default managing organisation to owning organisation
* validate user belongs to organisation
* update tests to specify created_by
* clear create_by for support users
* refactor
* typo
* rebase lint
* Add `updated_by` to logs to track who was the last person to update a log
- Reset `created_by` automatically when a form is updated and the owner does not belong to the managing or owning organisation
* move reset_invalidated_dependent_fields!, update schema file and fix tests
Co-authored-by: James Rose <james@jbpr.net>
* Include shared validations in sales log model and run validate_numeric_min_max method
* Add non london hard max income validation
* Add london income validation
* Remove child vlidation because buyer cannot be a child
* Add income1_value_check column
* Add buyer_1_income_value_check question and page
* Update income1_under_soft_min?
* Add mortgage and value check column
* Add mortgage value check page
* Update mortgage_over_soft_max? in soft validateions
* Remove unused error message