* 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
* add start of bulk upload logs journey
* split upload controller into 2
* add year page to bulk upload journey
* bulk upload years now dynamic
* add placeholder for upload your file page
* handle bulk upload when not in crossover
* add bulk upload csv user journey
* bulk upload now persists and sends to S3
* swap ruby-filemagic for file command
* match csv or text file for validation
* in_crossover_period? now uses overlap of forms
- also moved from Form to FormHandler
* add production env var for CSV bucket
* stub kernel call methods
* remove duplicate env var
* hardcode env var for review apps
* move feature toggle to FeatureToggle
* crossover period checks now specific to the form
* fix typo in bulk upload journey
* feat: start adding scheme validation for when owning org doesn't hold stock
* feat: don't set owning_organisation = nil in validate_owning_organisation
* style: line code
* test: remove redundant test for missing owning org
* test: add test for invalid owning org id (invalid as doesn't hold stock)
* test: add test that including owning org does nothing when user is coordinator
* test: standardise missing params test descriptions in schemes_controller_spec
* test: remove owning org id from required params list for data coordinators
* test: write "support user", not just "support"
* test: fix incorrect test descriptions
* test: test validation raised when updating model with non-stock-owning org
* config: set dummy_org in seeds as holding own stock
* test: test for actual validation string, not the validation lookup
* refactor: change owning_organisation_id: organisation.id to owning_organisation: organisation
* test: move scheme params def onto 1 line
* style: move "validate :validate_owning_organisation" onto new line
* add start of bulk upload logs journey
* split upload controller into 2
* add year page to bulk upload journey
* bulk upload years now dynamic
* bulk upload journey: add copy for prepare file
* add link to bulk upload template
* add placeholder for upload your file page
* handle bulk upload when not in crossover
* fix tests around bulk upload redirect
* fix typos in bulk upload jouney
* feat: add scheme reactivation behaviour
* test: add tests
* refactor: linting
* fix: find deactivation periods by scheme/location ids rather than just the first
* feat: add activating_soon status to location (not to schemes as they have no startdate field)
* feat: fix logic and add tests fo activating soon
* fix: check for startdate presence
* route deactivated scheme to reactivation page
* Render correct reactivate question content
* refactor into a helper
* display successful reactivation banner for default date
* Save reactivation date
* Add reactivation errors
* lint and fix url in tests
* make toggle translations generic
* Add reactivation status
* Reuse date validation messages
* Show deactivate this location when location is reactivating soon
* Display correct confirmation banner
* Add validation for reactivation date before deactivation date
* Improve availability label
* Use current collection start date if created at is later than that
* Update paths
* Fix controller and don't display the previous day if location availability start afterwards
* refactor availability label
* Filter out active periods
* lint
* Refactor active_period method into the model
* Allow deactivations and reactivations from available from date instead of start of the collection date
* Prevent deactivations during deactivated periods
* lint
* typo
* Remove active periods that last 1 day (because they get deactivated on the same day)
* Move the active_periods into helper
* extract remove_overlapping_and_empty_periods into a separate method
* Remove nested deactivation periods
* Make deactivate/reactvate location form use location_deactivation_period model
* refactor toggle date methods
* extract shared condition
* update validations
* refactor validations
* Update schemes deactivation form to use dectivation model
* Refactor
* lint
* remove redundant location_id and update scheme controller
* update active_periods
* feat: wip update scheme summary page
* feat: wip deactivate scheme schemes page
* feat: wip toggle active page
* feat: wip set deactivation_date to a datetime (to be more specific times later_
* Change conditional question controller to accommodate all models
* feat: add specific datetimes for deactivation
* feat: correct date and add notice
* feat: wip error behaviour
* feat: wip errors
* feat: wip errors refactoring
* feat: wip errors more refactoring
* refactor: linting
* feat: add second error in correct position and wip date range error
* feat: remove unneccessary db field
* feat: change type values to strings
* refactor: tidy up controller logic
* refactor: use same structure as locations deactivation
* feat: add general partially missing date input error
* feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller
* feat: fix tests, add status tag behaviour and remove unnecessary nils
* refactor: linting
* refactor: erblinting
* refactor: remove redundant line
* refactor: respond to PR comments 1
* refactor: respond to PR comments 2
* refactor: respond to PR comments 3
* refactor: respond to PR comments 3 (locations side)
* fix: remove @locations in location model
* fix: remove @locations in location model
* fix: update status names
* feat: wip validation update
* feat: add validation to model layer
* feat: further separate scheme deactivation behaviour
* test: update tests to new flow
* feat: respond to pr comments and add dynamic success text
* feat: duplicate behaviour schemes -> locations (+ tests)
* refactor: linting
* refactor: typo and remove unnecessary line for this PR
* refactor: feature toggle simplification
* Refactor locations and schemes controller actions
- Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to
- Make all deactivation date comparision UTC time
* feat: update deactivation_date validation and add tests
* refactor: linting
Co-authored-by: Kat <katrina@kosiak.co.uk>
Co-authored-by: James Rose <james@jbpr.net>
* add deactivation_date to locations
* Change conditional question controller to accommodate all models
* UI spike
* Update toggle-active views and render them correctly
* Display 2 errors
* Update errors
* Extract text to translation file
* Add collection start date
* Add out of range validation
* Update affected logs label
* lint
* Add status method
* update the displayed status tags
* Keep deactivation_date_type selected if an error occurs
* refactor deactivation_date_type to use default and other as options instead of 1 and 2
* refactor
* refactor
* update lettings logs
* Add reactivate ocation button and path
* Fix controller and update deactivate confirm page
* Don't actually update the logs data when deactivating a location
* lint and typos
* update a path
* update current_collection_start_date
* Remove unused scope
* feat: add renewal validation on rsnvac
* test: check sensible error seen when rsnvac is renewal and but letting is not a renewal
* test: change renewal validation check to fetch error message dynamically
* feat: lint code
* feat: write record.renewal.present?, not record.renewal
Co-authored-by: James Rose <james@jbpr.net>
Co-authored-by: James Rose <james@jbpr.net>
* feat: add 2022 rent range data, update rake task for population of this
* feat: change file format so ranges_rent_id is recognised
* feat: add updated error messages and casing
* tests: make tests pass
* feat: ensure there is a location_code in all locations and use this (and beds = 0) for supported housing rent validations
* feat: fix general needs validation behaviour
* feat: add local authorities enum to location.rb
* feat: ensure case when beds > 4 is accounted for
* feat: add error messages on property postcode page as well as la page
* feat: add error messages on scheme_id and location_id as well as la page
* feat: add error messages on scheme_id and location_id as well as la page
* feat: null coalescing and validations on changing las to one that invalidates rent in supported housing
* feat: nil protection
* refactor: linting
* refactor: combining duplicated logic
* tests: add hard validation tests split by needstype
* feat: update validations when beds > 4
* feat: update validations when beds > 4
* refactor: simplification, use preivous la method
* refactor: response to PR comments, fixing beds.negative validation
* feat: remove dynamic local auth name text from interruption screens - to be added back in later if this becomes a priority, would need some work on adding local auth name to log for supported housing logs not just leaving it in the location
* feat: add 2022 rent range data, update rake task for population of this
* feat: change file format so ranges_rent_id is recognised
* feat: add updated error messages and casing
* tests: make tests pass
* feat: add validation for voiddate and mrcdate when startdate changed after these have been added later
* test: add tests for new validations
* refactor: remove unnecessary parens
* feat: add la manual edit page
* feat: make autocomplete accesible and la readable
* feat: add correct skip and linking behaviour, also rename fallback page
* feat: add page not found and tidy la list
* feat: add redirection behaviour
* feat: add coping with nil add_another_location query string
* test: add postcodes mocks to return local authorities
* feat: validate local authority to not be nil or "Select an option"
* feat: persist add_another_location even on validation failure
* feat: remove url query parsing, put validation before values added to db
* refactor: spacing
* tests: add new tests for edit-local-authority
* tests: remove redundant bangs
* Change property major repairs date validation from 2 years to 10
* add voiddate_date_in_soft_range? and major_repairs_date_in_soft_range? methods
* update error messages for hard validations
* Add property_major_repairs_value_check to the form
* add void_date_value_check and fix some namings
* Update value_check hidden in check answers to depend on whether the questions is answered
* Remove a schema key
* extract constants for number of days
* change error messages wording
* update schema and csv files
* reset managing org for sheme
* only display schemes with managing org id
* only display relevant answers in show scheme page
* tests
* check arrangement type from saved scheme if incoming params for it is nil
* don't override managing org id if it's coming through as nil
* convert to use values that won't change for checks
* Revert "convert to use values that won't change for checks" because the value coming through from the params is the value and not a key
This reverts commit 50053ec0cf233e3a6c36db9af2528c354d3d60e7.
* Test
* check constant values
* Add test case for controller, check if the scheme is confirmed before displaying
* validate all the required scheme questions are answered
* fix ui
* fix test
* Add test, change error message wording
* Display error message next to the relevant field
* update context and query
* lint
Co-authored-by: Dushan Despotovic <dushan@madetech.com>
* Fix data mapping for mantype
This was mapped to a column called support services provider which was an
integer, this now maps to the arrangement type column. This should be in
line with expectations for the import/export
* remove unused stuff
* lint fixes
* changes to comparison
* fix lambda checks in view
* fix export test
* Add mobility type question
* Remove wheelchair_adaptation, use mobility_type to infer wchair
* Add validatio to mobility type
* tests
* Rebase main
* CYA test
* extract selection methods into a helper
* testing location validity
* testing for invalid startdate
* testing for invalid startdate in controller
* redundant method
* redundant if
* added tests
* using blank
* using || insetad of &&
* validation error messages for scheme
* WIP for validations
* fixed redirects for a correct page
* expecting link to a new question
* added support_services_provider
* WIP for support_services_provider
* WIP for support_services_provider - works concenptually
* WIP passing feature tests
* WIP passing feature tests
* WIP validations
* passing tests and working functionality
* location validations
* fixed after rebasing
* fixed edit name
* fixed after rebasing
* tests for missing params
* tests for validations
* tests for validations locaion
* tests for validation of all params for scheme
* tests for location validations
* What is this type of scheme? - Order options alphabetically:
* Care Standards Act 2000? - Order options as follows, add missing hint text for third option
* further styling
* last UI changes
* lmoved back button logic to the view
* select options in the view
* missing validation for manaing org
* fixed check answers page
* wip
* small change
* fixed
* fixed check answers page ui
* fixed updating
* fixed tests
* fixed layout
* final touches
* rebase
* rubocop
* correct condition
* old test
* Add location startdate column to the db
* Display the schemes with active locations only when selecting a scheme for a case log
* When selecting a location for case log, only show active locations
* Add startdate to the form
* only display the number of active locations in the appended text
* Compare date instead of time
* Put location questions and hints into a translation file
* lint
* content change
* added test to find link to create a new scheme
* added button to create a new scheme
* testing arriving to the new scheme form
* non exsiting link to controller new action
* SPIKEEEE
* first page complete
* posting to create
* refactored scheme to enums
* refactored new scheme page to use enums as well
* views
* SPIKE WIP
* SPIKE WIP
* SPIKE WIP
* drawing list of scheme details
* expanded on feature seeing more fields to fill in
* expanded on feature seeing more fields to fill in 2nd page
* refactored
* working back buttons
* working flash
* more change in wip
* default value for org
* working spike
* some spacing
* filling answers
* spike finished
* correct name for details
* testing fill in details
* removed gem and further tests
* Add has other client group field to schemes. Display it in the check answers. Fix tests and routing
* remove details view and path
Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
* WIP change update paths
* Implement changing answers (except the details one)
* Add details page back for editing scheme details
* added missing test for support questions and nested check answers under correct context
* checking the back functionality
* rubo and lint
* checking the back functionality for primary gourp
* checking the back functionality for confirm secondary
* checking the back functionality for secondary group
* checking the back functionality for support answers
* checking the back functionality for returning to check answers from details page
* checking the back functionality for returning to check answers from primary group page
* checking the back functionality for secondary group confirm yes
* checking the back functionality for secondary group confirm yes - fixed
* checking the back functionality for secondary group
* checking the back functionality for secondary group -fixed
* checking the back functionality for returning from support page
* Do not display secondary client group if the scheme doesn't have one
* Add details path to schemes controller update method
* Add more tests for back button
* Add tests for new controller method
* Add tests for creating schemes as data coordinator
* fixed schema
* added test for missing params when creating scheme
* create for support user with or withotu required param
* code to get controller render errors when required param is missing
* code to implement correct validation
* code to implement correct validation - part 2
* highlight missing field
* doing silly dance to get correct field highlighted on the error
* testing patch for schemes
* testing patch for schemes - correct path
* small refactoring
* testing primary client group update via regular path
* testing primary client group update via check answers page
* testing confirm secondary group update with YES NO and returning from check answers page
* testing updating secondary client group update and returning from check answers page
* testing support answers and returning from check answers page
* testing details and returning from check answers page
* weird path when no names supplied
* rubocop
* lost in rebasing
* started id to code refactoring
* model specs remastered
* fixed scheme controller specs
* further refactorings
* fixing feature schemes
* final touches
* removed code from db
* remaining code purged
* rubocop
* included check for owning org field
* checking for stock owning org selection
* added stock owning org
* added stock owning org on new page
* added stock owning org to details
* removed total units
* managing related schems properly via Org
* managing related schems properly via Org - rubocop
* small refactoring
* small refactoring - 2
* small refactoring - 3
* tests for owned_schemes and managed_schemes
* rubocop
* added tests for support user creating scheme
* rubocop -a
* tests for a primary-client-group
* tests for a secondary-client-group
* tests for a confirm-secondary-client-group
* tests for a check-answers
* tests for a details
* rubocop
* redundant action in controller
* Trigger WF
* switched to int for confirm
* flashing test
* flashing test for support user
* flashing test rubocop
Co-authored-by: Kat <katrina@madetech.com>
Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
* Major repairs question should be valid if void date question is
* Add task to reimport major repairs answers
* Correct error message string
* Add logging
* Spec logging
* update hard validation limits for pregnancy age, remove hard validation if there are no females at all
* Add soft validations for pregnancy
* make the error message consistent
* Only check the values for the members with details known in the household
* Show interruption screen when resident details are updated
* Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen
Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
* update validation messages
* fix a test
* fix a typo
Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>