* 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
* refactor with extract method
* can filter logs by bulk upload
* hide log creation button when viewing bulk upload
- this affects the logs index page filtering logs from a specific bulk
upload
* add info banner to bulk upload logs
* placeholder for bulk upload logs header
* when resuming bulk upload set filters
* fill place holder with remaining logs to fix
* add interstitial to resume if logs resolved
* after resolving bulk upload logs show interstitial
* fix linting error
* extract view variable to helper method
* test: check managing org not gone from answer opts when relationship deleted
* feat: add current managing org to answer opts
* feat: check if managing org exists before trying to show it
* wip
* test: improve managing orgs opts test when not support
* test: improve managing orgs opts tests when support
* test: make relationship deletion test consistent with other tests
* test: add "(with hint)" to managing org opts test descriptions
* test: refactor managing orgs opts tests for support user case
* fix: don't call user in get_answer_label in CYA component
* style: reorder instance vars and remove old comments in managing_organisation.rb
* refactor: ensure label_from_value always accepts log & nil as args
* lint
* test: pass in log and user in housing provider opts test for support user
* test: update housing provider opts tests for non-support user
* feat: update housing provider answer opts to include current HP in db
* style: add space after user definition
* test: make context definition more human-readable
* test: refactor housing providers opts tests (not support user)
* test: check housing prov. still selectable after deleting relationship
* fix: define log and current_user instance vars in label_from_value (housing prov.)
* lint
* test: update lettings log feature tests
to differentiate between different numbers of stock owners when acting as a data coordinator
* test: check owning & managing orgs set correctly when a log is created
* test: add line breaks and start context descriptions with and (not if)
* test: artificially reference org_rel2 to avoid lint offense
* feat: don't set log owning org as user's org if that org doesn't hold stock
* test: improve test context descriptions in lettings_log_spec
* test: finish overhauling owning and managing org tests in lettings_log_spec
* test: change let! to let where possible in spec/features/lettings_log_spec.rb
* test: change let! to let where possible in spec/models/form/lettings/questions/managing_organisation_spec.rb
* test: change let! to let where possible in spec/models/form/lettings/questions/stock_owner_spec.rb
* test: remove if statement from "coordinator user's org doesn't hold stock" managing org test
* test: remove if statement from "coordinator user's org does hold stock" no managing orgs managing org test
* test: remove if statement from "coordinator user's org does hold stock" >=1 managing orgs managing org test
plus refactor previous test
* test: explicitly reference org rels in "coordinator user's org doesn't hold stock" managing org test
* test: don't create vars inside other vars (for tests edited/created in this branch)
* chore: save schema changes after migration
Co-authored-by: Phil Lee <asmega@users.noreply.github.com>
* lockdown bulk upload routes
* able to view lettings bulk upload errors
* add error count to bulk upload results
* coverage for bulk upload filename on results
* group bulk upload errors by row on results
* able to view bulk upload sales results
* scope lettings and sales bulk upload results
* fix linting
* call service correctly in test
* add bulk upload sales questions mapping
* appease linter
* bulk upload error shows correct question
- depending on log type it will show relevant question for the field
concerned
* use local disk for bulk upload for dev env
- this saves the need to connect to S3 to play with bulk upload in dev
environment
* improve namespacing of classes
* add job to process bulk uploads
* use local disk storage for dev file upload
* fix test
* use inline active job queue_adapter for dev
* use test active job queue adapter for test env
* remove rubocop violation
* delete bulk upload from disk after processing
* populate errors with cell, row + metadata
* update error message with something meaningful
* shim in sales validator
* able to parse sales bulk uploads
* change migration to add purchase_code to errors
* bulk upload error component renders purchaser code
- when a sales log
* populate purchaser_code for bulk upload errors
- when log type is sales
* remove superfluous private method
* 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>
* CLDC-1688 Affected logs mailer
* CLDC-1688 Correct update_logs path
* CLDC-1688 Review markups
Co-authored-by: James Rose <james@jbpr.net>
Update app/controllers/schemes_controller.rb
Co-authored-by: James Rose <james@jbpr.net>
Update app/controllers/locations_controller.rb
Co-authored-by: James Rose <james@jbpr.net>
* Refactor to queue messages
* Update test
* remove irrelevant test
Co-authored-by: James Rose <james@jbpr.net>
Co-authored-by: Kat <katrina@kosiak.co.uk>
* 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
* Conditionally display a correct review log text
* do not allow the aswers from previous collection windows to be changed
* does not let the user navigate to questions for previous collection year logs
* Fix tests
* Add some docs
* Extract collection period check into a before_action and change path to rails route
* update the tasklist message
* Add sorting per org
* Pull out confirmed set to null because they're also not marked as confirmed
* Create relevant tests
* Extract scopes and remove wrong test
* Mark log as impacted by deactivation when location is deactivated
* Display affected logs in the table
* Route affected logs to tenancy start date question
* Update routes to get the tenancy start date page from form
* update next_page_redirect_path
* rename column
* Fix tests
* Add next_unresolved_page_id to pages
* Update unresulved when the log is corrected
* Mark logs as unresolved when scheme gets deactivated
* display correct content when there are no unresolved logs
* mark logs resolved after the user leaves check answers page
* Display link in success banner and reset banner when the link is clicked
* display inset hint text for unresolved log questions
* Display unresolved logs banner
* update banner message
* Persist the link in the banner
* update inset text
* Update success banner text
* Add unresolved and created_by scopes
* rename method
* add unresolved_log_redirect_page_id to form + typo and route
* Add UnresolvedLogHelper and extract flack notice message
* pluralize and return early
* remove flash[:notice] = nil
* to keep it consistent for sales log
* Extract unresolved path and fix a link
* extract resolve method and fix attribute nme
* update path
* typo
* 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: remove redundant cols from locations table
* feat: add status col to locations table
* test: start adding status tag tests
* test: pick the simplest format for the tag helper tests
* feat: make the locations table (plus related content above & below) 2/3 width
* feat: add incomplete to location status method
* test: all status tag helpers
* test: update test text to match what's being tested
* test: update locations list test in locations_controller_spec.rb
* test: update locations list test in schemes feature tests
* test: that status=incomplete when mandatory info is missing
* feat: simplify logic for incomplete status
Co-authored-by: James Rose <james@jbpr.net>
* feat: hide new locations table layout behind feature flag
* feat: use route helpers to get scheme_location path
* feat: simplify "scheme_id: @scheme.id" to "@scheme"
* feat: reference location, not @location, in scheme_location_path
* feat: reorder postcode and code in locations table
* feat: change ' ' to "" in location_spec
* feat: update wording and ordering for 'view location details' page
* test: re-add tests for locations page when new layout not enabled
* test: check for mobility_type and location_admin_district in locations_controller as support user
* test: update locations helper test to match new field naming and ordering
* feat: always scale locations list by 2/3, not just when new layout used
* feat: scale the scheme details page by 2/3 to match the locations list page
* feat: only make scheme details and locations pages 2/3 scale if feature toggle on
* test: mock new locations layout feature toggle in tests
* feat: use the existing location_toggle_enabled instead of new_locations_table_layout_enabled
* refactor: don't use html inside ruby in locations index page
* refactor: use Rails routes in all places in locations index page
* style: lint
* feat: move logic from views/schemes/show into schemes_helper
* refactor: make consistent the removal of fields from SchemeHelper base_attributes
* test: improvements to tests
* test: make 'returns correct display attributes' tests sensible
* test: check scheme toggle off => no scheme status shown
* style: correct indentation in spec/helpers/schemes_helper_spec.rb
* test: that when owning = managing, "Organisation providing support" hidden
* style: lint code
* test: don't set scheme id explicitly in schemes_helper_spec
* style: reorder tag helper spec to match tag helper
* refactor: ensure display_scheme_attributes always takes user type
* test: make location incomplete status depend on location.confirmed
* test: add missing location validations for nil postcode & mobility type
Co-authored-by: James Rose <james@jbpr.net>
* Update affected logs count and skip the confirmation page if no logs are affected for locations
* Update affected logs count and skip the confirmation page if no logs are affected for schemes
* refactor
* remove Organisation#relationship_type
* add indexes and fk constraints to org relations
* remove relationship_type from seeds
- as these have now been removed
* seeding is now idempotent
* 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
* Remove deactivation date from schemes and add scheme deactivation periods table
* Update affected logs when a scheme gets deactivated
* Update status method
* Display availability timeline
* Update flash notice message
* 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 scopes to OrganisationRelationship
* Update seeds to have more than one org relationships
* Pass current_user to questions
* Add new questions
* Use feature flag
* Update specs
* Address comments
* 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
* wip
* Rename managing_agents column
* add managing relationship
* f
* feat: add my features branched off managing agents branch
* feat: update nav behaviour
* feat: simplify housing_providers view
* feat: fix pluralise to default to plural rather than singular
* feat: remove managing agent related code so can be merged directly
* tests: update tests and add new ones for housing_providers
* refactor: rubocop conciliation
* tests: fix failing navigation tests
* tests: one more plural test
* refactor: erb linting
* refactor: erb linting
* feat: right-align "Remove" text
* feat: update nokogiri to pass bundler-audit
* feat: grey out search button
* feat: remove section-break
Co-authored-by: Jack S <jacopo.scotti@softwire.com>
* 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
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 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