* update seeds to add self in review env, change spec to reflect this, update config yml to allow csv exports in review
* update interface of relevant methods
EmailCsvJob, LettingsLog.to_csv and LettingsLogCsvService consume codes_only flag
* update tests including adding a new csv file to test against
* update LettingsLogCsvService to output codes only csv
* correct minor error and linting
* enable codes only download in UI
- add link on lettings log index page
- pass codes_only flag through params in relevant links and methods
- convert flag to boolean in controller methods
* ensure link displayed successfully for all renderings of logs_list and params passed through relevant methods in organisations controller
* fix existing tests
* correct linting thing
* correct linting error
* update tests for lettings log controller
* correct linting errors
* update organisations controller tests
* make minor changes after code review
* remove changes made for testing on review app
* make codes only download visible to support users only
* change variable names throughout after info on rauby/rails naming conventions, update tests for change in who can view codes only download link
* rework csv service for readability, remove delegating methods from lettings log to keep all code to do with mapping between our domain and desired export format in one place
* update test name
* correct a small typo and remove a duplicated method after clever git merge conflict suggestion
* point review app at staging csv bucket for csv download
* change variables named codes_only_export to codes_only to avoid inconsistency
* write tests to ensure that differetn user roles have the correct permissions around csv download
* ensure that non support users may not download codes only exports
* correct a small error in a previous commit
* correct minor linting error
* remove question no longer needed and associated test file
* amend page and the other question in that page that determined whether the deleted question should be shown
update associated test files
* createa a migration to remove the column for the deleted question
* update test broken by changes
* fix test broken by changes
* 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
* Refactor details known to reuse pages and questions
* Refactor page_depends_on
* Use field_for_person
* feat: tweak person_known behaviour to only show for people 2-4, and ask person_known regardless of answer to previous person_known questions. Also remove redundant personx_known files
* test: update tests
* feat: add dynamic cya card titles
* refactor: simplificaiton
* refactor: use check_answers_card_number again
* refactor: linting
* tests: add card title tests for sales log CYA page
* refactor: linting
* feat: make private method private
* feat: update person known behaviour
* test: update tests
* test: update tests
* test: add new person known tests
* feat: remove buyer 1 working situation duplicated header
* refactor: linting
Co-authored-by: Kat <katrina@kosiak.co.uk>
* 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>
* 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 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>
* Don't crash when invalid checkbox answers are selected
* Ensure all checkbox selections are preserved not just the first that doesn't match the all
* Rubocop
* spiked extra values for location la
* test
* extra test
* extra spacing
* renamed argument
* refactored per Dans suggestions
* redundant tests
* redundant method
* redundant method
* redundant method - part 3
* redundant method - part 4
* 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 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
* add synonyms, appended text and hint text to the autocomplete
* update test part 1
* refactor synonym, append and hint methods to take in resource
* Fix tests and lint
* Change min autocomplete character length to 1
* change test
* infer case_log values from schemes
* only display relevant property information questions
* Add unittype_sh column
* Display the correct number of completed sections
* fix schema and migration
* Fix test failing in CI
This test was failing due to some different between UTC and BST time as the
record from the DB comes back with a UTC timezone. Comparing the integer values
of both will ensure that both timestamps are identical and should fix the
issue in the CI where it thinks the values are different
* only run query for scheme locations size once
Co-authored-by: Dushan <dushan@madetech.com>
* extract TYPE_OF_UNIT_MAP
* lint
* Use find insted of select
Co-authored-by: Dushan Despotovic <dushan@madetech.com>
* Refactor depends on in the form json to specify the object for the dependency
Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
* Remove org section
* Enable user based depends on
* Add question
* Question is derived
* Log debug message when values get auto cleared
* Enable answer options to be created from a model lookup
* Make organisation fields optional since they won't immediately have one when created by support users
* Add question to check answers page
* 22/23 fix
* Rubocop
* Spec check answers label lookup
* Only set managing organisation if not already set
* Bump deps
* Rescue lack of database connection for CI
Co-authored-by: Kat <katrina@madetech.com>
Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
This commit fixes the tests that failed as a result of the introduction
of the created_by column in the case log table. The tests were failing as
it is now necessary to have a created_by for a case log
* Remove Save and go to submit
* Update hidden_in_check_answers
* Add la_known to dynamically not required questions if postcode_known is yes or not filled in
* infer the correct field value and remove irrelevant dynamically not required line