While migrating users from the previous service to the new one we discovered that email addresses are not unique in the previous service. This means that one user in the new service might relate to multiple users in the previous service.
This change:
- Adds a new LegacyUser model that can belong to a User. Each LegacyUser model has one old_user_id that corresponds to the user ID in the legacy service.
- Updates the user import service so that we create this association for new users
- Creates a Rake script to backfill the association for existing users
* Add shared ownership type question and page
* Add type column to the sales logs table
* Add ownership scheme field to db
Isolating this into a separate commit so it can be cherry picked for any
other sales logs work that's necessary.
* Fix tests
* fix a test
* Fix typo
* Set default time for form handler
Co-authored-by: Dushan Despotovic <dushan@madetech.com>
* Add previous, current and next forms to form handler
* Add current, previous and next sales forms to form handler
* Implement current_lettings_form, current_sales_form and store year and form type in form
* refactor lettings_forms
* Use current, previous and next forms in lettings log model
* Use current, previous and next forms in sales log model
* use current, previous and next forms in csv service
* Remove "startyear_endyear" forms from form handler
* Remove name from form initializer and add an optional start year
* refactor get_form
* update csv test, fix form initialize
* rebase fix
* Refactor form_name_from_start_year method out
* remove unused variable
* fix typo, add date tests
* rebase, fix tests
* add comment to before test block
* Change the FormHandler back to only contain the form objects
* extract name
* Add abstract log class and sales log class
Created a parent log class for sales log and lettings log. Any bits common
to both sales and lettings can live in the parent class. As the sales log
functionality is built up any commonalities with lettings log can be extracted
into the parent log class. The sales log model is set up without a json form
and instead the form is defined in code - like the setup section of the lettings
log.
* update sales logs controller
* update lettings controller specs
* update filter method name
* update organisations controller
* use lettings method
* Add deleted tests back
* lint
Co-authored-by: Kat <katrina@madetech.com>
Co-authored-by: Kat <kosiak.katrina@gmail.com>
This renames the case_log to lettings_log as everything we've written so
far has been geared towards lettings of social housing so it makes sense to
have the name describe this. This is also a precursor to adding in stuff for
sales logs (whatever shape that takes)
Co-authored-by: James Rose <james@jbpr.net>
* wip
* add missing values to factory bot and lint
* remove irrelevand methods
* dont infer housingneeds
* typo
* update method name
* Remove housingneeds_present? method
* move set housing needs fields to case log variables file
* Only set all housing needs values to 1 if there are no housingneeds
* update json form fixture
* link
* update csv test
Co-authored-by: Dushan Despotovic <dushan@madetech.com>
* 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
* remove irrelevant fields from csv based on the user
* display yes/no instead of true/false
* display organisation and user names instead of ids
* refactor tests
* Update remote schema.rb with migrations, main features for this ticket still incoming
* Add join table for organisation self-referential parent/child relationships
* Add join table for organisation self-referential parent/child relationships
* Remove organisation_la factory and add test for organisation_relationship child/parent association
* Update spec/models/organisation_spec.rb
Co-authored-by: James Rose <james@jbpr.net>
Co-authored-by: James Rose <james@jbpr.net>
* Reset wchair when needstype changes from supported housing to not supported housing
Co-authored-by: James Rose <jamesrose@users.noreply.github.com>
* remove location_id if scheme needstype changes to general needs
* only hide postcode known question from check your answers if it's answered
Co-authored-by: James Rose <jamesrose@users.noreply.github.com>
* 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>
* Add search
* Add "Add location" button
* Add confirmed flag to schemes
* Show location tab is location is being added to an existing scheme
* Switch button text when scheme exists already
* Remove change links for confirmed schemes
* Fix spec after rebase
* added title showing search results and tests for it
Co-authored-by: JG <moarpheus@gmail.com>
* 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
* Prevents location from being cleared when it has been changed alongside the scheme
* Handles visible IDs not being system unique
* Hides the location correctly