Browse Source

Yarn package upgrades (#2590)

* Upgrade yarn packages to clear dependabot warnings

* Add prettier

* Run prettier

* Update docs

* Update babel config for moved plugins

* Add node_modules and similar to prettierignore, since on CI it's not run from same directory as gitignore
equation-before-demo
Rachael Booth 4 months ago committed by GitHub
parent
commit
3773dd7d9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      .github/workflows/aws_deploy.yml
  2. 19
      .prettierignore
  3. 1
      .prettierrc
  4. 12
      .rubocop.yml
  5. 10
      README.md
  6. 10
      app/frontend/styles/_button.scss
  7. 2
      app/frontend/styles/_feedback.scss
  8. 4
      app/frontend/styles/_filter-layout.scss
  9. 8
      app/frontend/styles/_filter.scss
  10. 4
      app/frontend/styles/_panel.scss
  11. 2
      app/frontend/styles/_primary-navigation.scss
  12. 2
      app/frontend/styles/_sub-navigation.scss
  13. 2
      app/frontend/styles/_table-group.scss
  14. 2
      app/frontend/styles/_task-list.scss
  15. 13
      app/views/content/privacy_notice.md
  16. 8
      babel.config.js
  17. 288
      config/forms/2021_2022.json
  18. 920
      config/forms/2022_2023.json
  19. 16
      config/forms/schema/2021_2022.json
  20. 27
      config/forms/schema/generic.json
  21. 1
      config/storage.yml
  22. 2
      docker-compose.yml
  23. 1
      docs/adr/adr-015-asset-pipeline.md
  24. 1
      docs/adr/adr-018-form-setup.md
  25. 1
      docs/adr/adr-019-form-end-dates.md
  26. 31
      docs/api/v1.json
  27. 10
      docs/app_api.md
  28. 8
      docs/documentation_website.md
  29. 11
      docs/infrastructure.md
  30. 13
      docs/monitoring.md
  31. 90
      docs/setup.md
  32. 13
      docs/testing.md
  33. 7
      lib/tasks/lint.rake
  34. 5
      package.json
  35. 58
      spec/fixtures/forms/2021_2022.json
  36. 4
      spec/fixtures/forms/2022_2023.json
  37. 4583
      yarn.lock

4
.github/workflows/aws_deploy.yml

@ -53,7 +53,7 @@ jobs:
id: ecr-login id: ecr-login
uses: aws-actions/amazon-ecr-login@v1 uses: aws-actions/amazon-ecr-login@v1
with: with:
mask-password: 'true' mask-password: "true"
- name: Check if image with tag already exists - name: Check if image with tag already exists
run: | run: |
@ -90,7 +90,7 @@ jobs:
id: ecr-login id: ecr-login
uses: aws-actions/amazon-ecr-login@v1 uses: aws-actions/amazon-ecr-login@v1
with: with:
mask-password: 'true' mask-password: "true"
- name: Get timestamp - name: Get timestamp
id: timestamp id: timestamp

19
.prettierignore

@ -0,0 +1,19 @@
# Ignore everything except as negated below
*
!*.scss
!*.md
!*.yml
!*.json
# Ensures subdirectories are checked for files matching the above
!*/
config/locales/
app/views/content/data_sharing_agreement.md
/node_modules
/vendor
/coverage
/public/assets
/app/assets/builds/*

1
.prettierrc

@ -0,0 +1 @@
{}

12
.rubocop.yml

@ -11,12 +11,12 @@ inherit_gem:
AllCops: AllCops:
Exclude: Exclude:
- 'bin/*' - "bin/*"
- 'db/schema.rb' - "db/schema.rb"
- 'node_modules/**/*' - "node_modules/**/*"
- 'config/application.rb' - "config/application.rb"
- 'config/puma.rb' - "config/puma.rb"
- 'vendor/**/*' - "vendor/**/*"
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false

10
README.md

@ -7,11 +7,11 @@ Ruby on Rails app that handles the submission of lettings and sales of social ho
## Domain documentation ## Domain documentation
* [Domain and technical documentation](https://communitiesuk.github.io/submit-social-housing-lettings-and-sales-data) - [Domain and technical documentation](https://communitiesuk.github.io/submit-social-housing-lettings-and-sales-data)
* [Local development setup](https://communitiesuk.github.io/submit-social-housing-lettings-and-sales-data/setup) - [Local development setup](https://communitiesuk.github.io/submit-social-housing-lettings-and-sales-data/setup)
* [Architecture decision records](https://communitiesuk.github.io/submit-social-housing-lettings-and-sales-data/adr) - [Architecture decision records](https://communitiesuk.github.io/submit-social-housing-lettings-and-sales-data/adr)
* [API browser](https://communitiesuk.github.io/submit-social-housing-lettings-and-sales-data/api) (using this [OpenAPI specification](docs/api/v1.json)) - [API browser](https://communitiesuk.github.io/submit-social-housing-lettings-and-sales-data/api) (using this [OpenAPI specification](docs/api/v1.json))
* [Design history](https://core-design-history.herokuapp.com) - [Design history](https://core-design-history.herokuapp.com)
## User interface ## User interface

10
app/frontend/styles/_button.scss

@ -1,8 +1,14 @@
$app-button-shadow-size: $govuk-border-width-form-element; $app-button-shadow-size: $govuk-border-width-form-element;
$app-button-inverse-background-colour: govuk-colour("white"); $app-button-inverse-background-colour: govuk-colour("white");
$app-button-inverse-foreground-colour: $govuk-brand-colour; $app-button-inverse-foreground-colour: $govuk-brand-colour;
$app-button-inverse-shadow-colour: govuk-shade($app-button-inverse-foreground-colour, 30%); $app-button-inverse-shadow-colour: govuk-shade(
$app-button-inverse-hover-background-colour: govuk-tint($app-button-inverse-foreground-colour, 90%); $app-button-inverse-foreground-colour,
30%
);
$app-button-inverse-hover-background-colour: govuk-tint(
$app-button-inverse-foreground-colour,
90%
);
.app-button--inverse, .app-button--inverse,
.app-button--inverse:link, .app-button--inverse:link,

2
app/frontend/styles/_feedback.scss

@ -88,7 +88,7 @@
&:hover { &:hover {
// backup style for browsers that don't support rgba // backup style for browsers that don't support rgba
background: govuk-colour("mid-grey"); background: govuk-colour("mid-grey");
background: rgba(govuk-colour("black"), .2); background: rgba(govuk-colour("black"), 0.2);
color: govuk-colour("black"); color: govuk-colour("black");
} }

4
app/frontend/styles/_filter-layout.scss

@ -34,7 +34,9 @@
.app-filter-layout__content { .app-filter-layout__content {
@include govuk-media-query(wide) { @include govuk-media-query(wide) {
float: right; float: right;
max-width: calc(#{govuk-grid-width("three-quarters")} - #{govuk-spacing(6)}); max-width: calc(
#{govuk-grid-width("three-quarters")} - #{govuk-spacing(6)}
);
width: 100%; width: 100%;
} }
} }

8
app/frontend/styles/_filter.scss

@ -5,7 +5,7 @@
.govuk-checkboxes__label, .govuk-checkboxes__label,
.govuk-radios__label { .govuk-radios__label {
&:before { &::before {
background-color: govuk-colour("white"); background-color: govuk-colour("white");
} }
} }
@ -47,7 +47,9 @@
&:focus { &:focus {
background-color: $govuk-focus-colour; background-color: $govuk-focus-colour;
color: $govuk-focus-text-colour; color: $govuk-focus-text-colour;
box-shadow: 0 -2px $govuk-focus-colour, 0 4px $govuk-focus-text-colour; box-shadow:
0 -2px $govuk-focus-colour,
0 4px $govuk-focus-text-colour;
outline: none; outline: none;
} }
@ -57,7 +59,7 @@
border: 0; border: 0;
} }
&:before { &::before {
background-image: url("../assets/images/icon-cross.svg"); background-image: url("../assets/images/icon-cross.svg");
content: ""; content: "";
display: inline-block; display: inline-block;

4
app/frontend/styles/_panel.scss

@ -19,8 +19,8 @@
margin-bottom: 0; margin-bottom: 0;
} }
.govuk-radios__label:before, .govuk-radios__label::before,
& :after { & ::after {
color: govuk-colour("black"); color: govuk-colour("black");
border-color: govuk-colour("black"); border-color: govuk-colour("black");
background-color: govuk-colour("white"); background-color: govuk-colour("white");

2
app/frontend/styles/_primary-navigation.scss

@ -54,7 +54,7 @@
@include govuk-typography-weight-bold; @include govuk-typography-weight-bold;
// Extend the touch area of the link to the list // Extend the touch area of the link to the list
&:after { &::after {
bottom: 0; bottom: 0;
content: ""; content: "";
left: 0; left: 0;

2
app/frontend/styles/_sub-navigation.scss

@ -64,7 +64,7 @@
position: relative; position: relative;
// Extend the touch area of the link to the list // Extend the touch area of the link to the list
&:after { &::after {
bottom: 0; bottom: 0;
content: ""; content: "";
left: 0; left: 0;

2
app/frontend/styles/_table-group.scss

@ -2,7 +2,7 @@
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
margin: govuk-spacing(-3) govuk-spacing(-3) govuk-spacing(3); margin: govuk-spacing(-3) govuk-spacing(-3) govuk-spacing(3);
padding: govuk-spacing(3) govuk-spacing(3); padding: govuk-spacing(3);
scrollbar-color: $govuk-text-colour govuk-colour("light-grey"); scrollbar-color: $govuk-text-colour govuk-colour("light-grey");
.govuk-table { .govuk-table {

2
app/frontend/styles/_task-list.scss

@ -10,7 +10,7 @@
} }
.app-task-list__section-heading { .app-task-list__section-heading {
@include govuk-font($size:24, $weight: bold); @include govuk-font($size: 24, $weight: bold);
display: table; display: table;
margin-top: govuk-spacing(0); margin-top: govuk-spacing(0);
margin-bottom: govuk-spacing(4); margin-bottom: govuk-spacing(4);

13
app/views/content/privacy_notice.md

@ -6,7 +6,6 @@ If your household enters a new social housing tenancy or purchases a social hous
The information is provided via ‘<%= t('service_name') %>’, a service funded and managed by MHCLG. It collects information on the tenants or residents, tenancy or sale, and the dwelling itself. Some of this data is personal and sensitive, so MHCLG is responsible for ensuring it’s processed in line with data protection legislation. The information is provided via ‘<%= t('service_name') %>’, a service funded and managed by MHCLG. It collects information on the tenants or residents, tenancy or sale, and the dwelling itself. Some of this data is personal and sensitive, so MHCLG is responsible for ensuring it’s processed in line with data protection legislation.
## Why do we share this information? ## Why do we share this information?
Information collected via CORE is shared with other government departments and agencies. It’s shared with the Greater London Authority and the Regulator of Social Housing. Data providers can also access data for their organisations via CORE. Data is only shared for research and statistical purposes. Information collected via CORE is shared with other government departments and agencies. It’s shared with the Greater London Authority and the Regulator of Social Housing. Data providers can also access data for their organisations via CORE. Data is only shared for research and statistical purposes.
@ -27,16 +26,16 @@ Information collected via CORE relates to your tenancy, the dwelling you are liv
Collected data will be held for as long as necessary for research and statistical purposes. When no longer needed, data will be deleted in a safe manner. We’re aware some collected data is particularly sensitive. For example: Collected data will be held for as long as necessary for research and statistical purposes. When no longer needed, data will be deleted in a safe manner. We’re aware some collected data is particularly sensitive. For example:
* ethnic group - ethnic group
* if previous tenure is a hospital, prison or approved probation hostel support - if previous tenure is a hospital, prison or approved probation hostel support
* if household left last settled home because discharged from prison, a long stay hospital or other institution - if household left last settled home because discharged from prison, a long stay hospital or other institution
* if referral source is probation or prison, youth offending or community mental health team, or health service - if referral source is probation or prison, youth offending or community mental health team, or health service
MHCLG publishes data annually, in aggregate form, as part of a report and complementary tables. MHCLG publishes data annually, in aggregate form, as part of a report and complementary tables.
* For annual lettings data, visit: [https://www.gov.uk/government/collections/rents-lettings-and-tenancies](https://www.gov.uk/government/collections/rents-lettings-and-tenancies) - For annual lettings data, visit: [https://www.gov.uk/government/collections/rents-lettings-and-tenancies](https://www.gov.uk/government/collections/rents-lettings-and-tenancies)
* For annual sales data, visit: [https://www.gov.uk/government/collections/social-housing-sales-including-right-to-buy-and-transfers](https://www.gov.uk/government/collections/social-housing-sales-including-right-to-buy-and-transfers) - For annual sales data, visit: [https://www.gov.uk/government/collections/social-housing-sales-including-right-to-buy-and-transfers](https://www.gov.uk/government/collections/social-housing-sales-including-right-to-buy-and-transfers)
Detail-level data is anonymised and protected, minimising identification risk. It's held with the UK Data Archive. Detail-level data is anonymised and protected, minimising identification risk. It's held with the UK Data Archive.

8
babel.config.js

@ -35,10 +35,10 @@ module.exports = function (api) {
'babel-plugin-macros', 'babel-plugin-macros',
'@babel/plugin-syntax-dynamic-import', '@babel/plugin-syntax-dynamic-import',
isTestEnv && 'babel-plugin-dynamic-import-node', isTestEnv && 'babel-plugin-dynamic-import-node',
'@babel/plugin-proposal-class-properties', '@babel/plugin-transform-class-properties',
'@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-object-rest-spread',
'@babel/plugin-proposal-private-methods', '@babel/plugin-transform-private-methods',
'@babel/plugin-proposal-private-property-in-object', '@babel/plugin-transform-private-property-in-object',
'@babel/plugin-transform-regenerator', '@babel/plugin-transform-regenerator',
'@babel/plugin-transform-runtime', '@babel/plugin-transform-runtime',
[ [

288
config/forms/2021_2022.json

@ -34,9 +34,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"postcode_full": [ "postcode_full": [1]
1
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -61,12 +59,14 @@
"is_la_inferred": true "is_la_inferred": true
} }
}, },
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"postcode_known": 0 "postcode_known": 0
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -851,9 +851,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"mrcdate": [ "mrcdate": [1]
1
]
} }
}, },
"mrcdate": { "mrcdate": {
@ -999,9 +997,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"tenancyother": [ "tenancyother": [3]
3
]
} }
}, },
"tenancyother": { "tenancyother": {
@ -1043,9 +1039,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"tenancyother": [ "tenancyother": [3]
3
]
} }
}, },
"tenancyother": { "tenancyother": {
@ -1277,9 +1271,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"age1": [ "age1": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -1301,12 +1293,14 @@
"max": 120, "max": 120,
"step": 1, "step": 1,
"width": 2, "width": 2,
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"age1_known": 1 "age1_known": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -2056,9 +2050,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"age2": [ "age2": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -2080,12 +2072,14 @@
"max": 120, "max": 120,
"step": 1, "step": 1,
"width": 2, "width": 2,
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"age2_known": 1 "age2_known": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -2591,9 +2585,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"age3": [ "age3": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -2615,12 +2607,14 @@
"max": 120, "max": 120,
"step": 1, "step": 1,
"width": 2, "width": 2,
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"age3_known": 1 "age3_known": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -3123,9 +3117,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"age4": [ "age4": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -3147,12 +3139,14 @@
"max": 120, "max": 120,
"step": 1, "step": 1,
"width": 2, "width": 2,
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"age4_known": 1 "age4_known": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -3652,9 +3646,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"age5": [ "age5": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -3676,12 +3668,14 @@
"max": 120, "max": 120,
"step": 1, "step": 1,
"width": 2, "width": 2,
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"age5_known": 1 "age5_known": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -4178,9 +4172,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"age6": [ "age6": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -4202,12 +4194,14 @@
"max": 120, "max": 120,
"step": 1, "step": 1,
"width": 2, "width": 2,
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"age6_known": 1 "age6_known": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -4701,9 +4695,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"age7": [ "age7": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -4725,12 +4717,14 @@
"max": 120, "max": 120,
"step": 1, "step": 1,
"width": 2, "width": 2,
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"age7_known": 1 "age7_known": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -5221,9 +5215,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"age8": [ "age8": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -5245,12 +5237,14 @@
"max": 120, "max": 120,
"step": 1, "step": 1,
"width": 2, "width": 2,
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"age8_known": 1 "age8_known": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -6251,7 +6245,7 @@
"value": "Other" "value": "Other"
}, },
"47": { "47": {
"value":"Tenant prefers not to say" "value": "Tenant prefers not to say"
}, },
"divider": { "divider": {
"value": true "value": true
@ -6261,9 +6255,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"reasonother": [ "reasonother": [20]
20
]
} }
}, },
"reasonother": { "reasonother": {
@ -6495,9 +6487,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"ppostcode_full": [ "ppostcode_full": [0]
0
]
}, },
"hidden_in_check_answers": { "hidden_in_check_answers": {
"depends_on": [ "depends_on": [
@ -6522,12 +6512,14 @@
"is_previous_la_inferred": true "is_previous_la_inferred": true
} }
}, },
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"ppcodenk": 1 "ppcodenk": 1
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
} }
}, },
@ -6560,9 +6552,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"prevloc": [ "prevloc": [1]
1
]
} }
}, },
"prevloc": { "prevloc": {
@ -6957,12 +6947,14 @@
"W92000004": "Wales", "W92000004": "Wales",
"9300000XX": "Outside UK" "9300000XX": "Outside UK"
}, },
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"previous_la_known": 0 "previous_la_known": 0
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
}, },
"depends_on": [ "depends_on": [
@ -7618,9 +7610,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"chcharge": [ "chcharge": [1]
1
]
} }
}, },
"chcharge": { "chcharge": {
@ -7715,9 +7705,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"chcharge": [ "chcharge": [1]
1
]
} }
}, },
"chcharge": { "chcharge": {
@ -7762,9 +7750,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"chcharge": [ "chcharge": [1]
1
]
} }
}, },
"chcharge": { "chcharge": {
@ -7809,9 +7795,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"chcharge": [ "chcharge": [1]
1
]
} }
}, },
"chcharge": { "chcharge": {
@ -7888,12 +7872,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every week", "suffix": " every week",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -7907,12 +7886,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every week", "suffix": " every week",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -7926,12 +7900,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every week", "suffix": " every week",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -7945,12 +7914,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every week", "suffix": " every week",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -7966,12 +7930,7 @@
"suffix": " every week", "suffix": " every week",
"readonly": true, "readonly": true,
"requires_js": true, "requires_js": true,
"fields_added": [ "fields_added": ["brent", "scharge", "pscharge", "supcharg"]
"brent",
"scharge",
"pscharge",
"supcharg"
]
} }
}, },
"depends_on": [ "depends_on": [
@ -8111,12 +8070,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every 2 weeks", "suffix": " every 2 weeks",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8130,12 +8084,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every 2 weeks", "suffix": " every 2 weeks",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8149,12 +8098,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every 2 weeks", "suffix": " every 2 weeks",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8168,12 +8112,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every 2 weeks", "suffix": " every 2 weeks",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8189,12 +8128,7 @@
"suffix": " every 2 weeks", "suffix": " every 2 weeks",
"readonly": true, "readonly": true,
"requires_js": true, "requires_js": true,
"fields_added": [ "fields_added": ["brent", "scharge", "pscharge", "supcharg"]
"brent",
"scharge",
"pscharge",
"supcharg"
]
} }
}, },
"depends_on": [ "depends_on": [
@ -8234,12 +8168,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every 4 weeks", "suffix": " every 4 weeks",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8253,12 +8182,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every 4 weeks", "suffix": " every 4 weeks",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8272,12 +8196,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every 4 weeks", "suffix": " every 4 weeks",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8291,12 +8210,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every 4 weeks", "suffix": " every 4 weeks",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8312,12 +8226,7 @@
"suffix": " every 4 weeks", "suffix": " every 4 weeks",
"readonly": true, "readonly": true,
"requires_js": true, "requires_js": true,
"fields_added": [ "fields_added": ["brent", "scharge", "pscharge", "supcharg"]
"brent",
"scharge",
"pscharge",
"supcharg"
]
} }
}, },
"depends_on": [ "depends_on": [
@ -8357,12 +8266,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every month", "suffix": " every month",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8376,12 +8280,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every month", "suffix": " every month",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8395,12 +8294,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every month", "suffix": " every month",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8414,12 +8308,7 @@
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every month", "suffix": " every month",
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge", "result-field": "tcharge",
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -8435,12 +8324,7 @@
"suffix": " every month", "suffix": " every month",
"readonly": true, "readonly": true,
"requires_js": true, "requires_js": true,
"fields_added": [ "fields_added": ["brent", "scharge", "pscharge", "supcharg"]
"brent",
"scharge",
"pscharge",
"supcharg"
]
} }
}, },
"depends_on": [ "depends_on": [
@ -8637,9 +8521,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"tshortfall": [ "tshortfall": [0]
0
]
} }
}, },
"tshortfall": { "tshortfall": {

920
config/forms/2022_2023.json

File diff suppressed because it is too large Load Diff

16
config/forms/schema/2021_2022.json

@ -4,12 +4,7 @@
"title": "Form", "title": "Form",
"description": "A form", "description": "A form",
"type": "object", "type": "object",
"required": [ "required": ["form_type", "start_year", "end_year", "sections"],
"form_type",
"start_year",
"end_year",
"sections"
],
"properties": { "properties": {
"form_type": { "form_type": {
"description": "", "description": "",
@ -40,9 +35,7 @@
"[a-z_]+": { "[a-z_]+": {
"description": "", "description": "",
"type": "object", "type": "object",
"required": [ "required": ["label"],
"label"
],
"properties": { "properties": {
"label": { "label": {
"description": "", "description": "",
@ -69,10 +62,7 @@
"[a-z_]+": { "[a-z_]+": {
"description": "", "description": "",
"type": "object", "type": "object",
"required": [ "required": ["header", "check_answer_label"],
"header",
"check_answer_label"
],
"properties": { "properties": {
"check_answer_label": { "check_answer_label": {
"description": "", "description": "",

27
config/forms/schema/generic.json

@ -4,12 +4,7 @@
"title": "Form", "title": "Form",
"description": "A form", "description": "A form",
"type": "object", "type": "object",
"required": [ "required": ["form_type", "start_year", "end_year", "sections"],
"form_type",
"start_year",
"end_year",
"sections"
],
"properties": { "properties": {
"form_type": { "form_type": {
"description": "", "description": "",
@ -40,9 +35,7 @@
"[a-z_]+": { "[a-z_]+": {
"description": "SubSection Name", "description": "SubSection Name",
"type": "object", "type": "object",
"required": [ "required": ["label"],
"label"
],
"properties": { "properties": {
"label": { "label": {
"description": "", "description": "",
@ -54,10 +47,7 @@
"^(?!(depends_on))[a-z_]+$": { "^(?!(depends_on))[a-z_]+$": {
"description": "Page Name", "description": "Page Name",
"type": "object", "type": "object",
"required": [ "required": ["header", "questions"],
"header",
"questions"
],
"properties": { "properties": {
"header": { "header": {
"description": "", "description": "",
@ -73,10 +63,7 @@
"[a-z_]+": { "[a-z_]+": {
"description": "Question Name", "description": "Question Name",
"type": "object", "type": "object",
"required": [ "required": ["header", "type"],
"header",
"type"
],
"properties": { "properties": {
"header": { "header": {
"description": "", "description": "",
@ -115,7 +102,8 @@
"description": "fields that get inferred based on the value of the current field", "description": "fields that get inferred based on the value of the current field",
"type": "object" "type": "object"
}, },
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"description": "value that gets displayed in the check answers for this field if the given condition is met", "description": "value that gets displayed in the check answers for this field if the given condition is met",
"type": "object", "type": "object",
"properties": { "properties": {
@ -128,7 +116,8 @@
"type": "object" "type": "object"
} }
} }
}] }
]
}, },
"minProperties": 1 "minProperties": 1
} }

1
config/storage.yml

@ -5,7 +5,6 @@ test:
local: local:
service: Disk service: Disk
root: <%= Rails.root.join("storage") %> root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon: # amazon:
# service: S3 # service: S3

2
docker-compose.yml

@ -1,4 +1,4 @@
version: '3.6' version: "3.6"
volumes: volumes:
dbdata: dbdata:

1
docs/adr/adr-015-asset-pipeline.md

@ -12,7 +12,6 @@ However, since Rails 7, it's been deprecated by the Rails CORE team and it's jav
The primary options considered were: The primary options considered were:
1. [Import maps](https://github.com/rails/importmap-rails) - Rails 7 default. Serve JS directly but do no transpiling so not suitable 1. [Import maps](https://github.com/rails/importmap-rails) - Rails 7 default. Serve JS directly but do no transpiling so not suitable
2. [JSBundling](https://github.com/rails/jsbundling-rails) - Rails recommended 2. [JSBundling](https://github.com/rails/jsbundling-rails) - Rails recommended
- With [ESBuild](https://esbuild.github.io/) - fast and does some transpiling but [doesn't support ES5/IE11](https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data/pull/203) - With [ESBuild](https://esbuild.github.io/) - fast and does some transpiling but [doesn't support ES5/IE11](https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data/pull/203)

1
docs/adr/adr-018-form-setup.md

@ -18,6 +18,7 @@ The amount of application context needed to make it work is what ultimately drov
Instead the setup section is now composed of coded Ruby class in `app/models/form/setup`. Instead the setup section is now composed of coded Ruby class in `app/models/form/setup`.
It still has all the same components as before: It still has all the same components as before:
- Section - Section
- Subsection - Subsection
- Pages - Pages

1
docs/adr/adr-019-form-end-dates.md

@ -12,6 +12,7 @@ There might be short extensions to the deadline, so shortly after the last day t
Also, if incorrect data is found during QA process, data providers might be asked to correct it. Once the data has been through its first QA processes and is as present and correct as possible, the ability to edit and delete logs is closed. This is typically in late summer/autumn, but it depends on the statistical analysis. Also, if incorrect data is found during QA process, data providers might be asked to correct it. Once the data has been through its first QA processes and is as present and correct as possible, the ability to edit and delete logs is closed. This is typically in late summer/autumn, but it depends on the statistical analysis.
To accommodate the different end dates, we will now store 3 different dates on the form definition: To accommodate the different end dates, we will now store 3 different dates on the form definition:
- Submission deadline (submission_deadline) - this is the date displayed at the top of a completed log in lettings and sales - "You can review and make changes to this log until 9 June 2024.". Nothing happens on this date - Submission deadline (submission_deadline) - this is the date displayed at the top of a completed log in lettings and sales - "You can review and make changes to this log until 9 June 2024.". Nothing happens on this date
- New logs end date (new_logs_end_date) - no new logs for that collection year can be submitted, but logs can be edited - New logs end date (new_logs_end_date) - no new logs for that collection year can be submitted, but logs can be edited
- Edit and delete logs end date (edit_end_date) - logs can no longer be edited or deleted. Completed logs can still be viewed. Materials / references to the collection year are removed. - Edit and delete logs end date (edit_end_date) - logs can no longer be edited or deleted. Completed logs can still be viewed. Materials / references to the collection year are removed.

31
docs/api/v1.json

@ -54,9 +54,7 @@
{ {
"schema": { "schema": {
"type": "string", "type": "string",
"enum": [ "enum": ["application/json"]
"application/json"
]
}, },
"in": "header", "in": "header",
"name": "Accept", "name": "Accept",
@ -109,9 +107,7 @@
"Invalid Age": { "Invalid Age": {
"value": { "value": {
"errors": { "errors": {
"age1": [ "age1": ["Tenant age must be between 16 and 120"]
"Tenant age must be between 16 and 120"
]
} }
} }
} }
@ -136,9 +132,7 @@
{ {
"schema": { "schema": {
"type": "string", "type": "string",
"enum": [ "enum": ["application/json"]
"application/json"
]
}, },
"in": "header", "in": "header",
"name": "Accept", "name": "Accept",
@ -177,9 +171,7 @@
{ {
"schema": { "schema": {
"type": "string", "type": "string",
"enum": [ "enum": ["application/json"]
"application/json"
]
}, },
"in": "header", "in": "header",
"name": "Accept", "name": "Accept",
@ -219,9 +211,7 @@
"reasonable_preference_reason": [ "reasonable_preference_reason": [
"If reasonable preference is Yes, a reason must be given" "If reasonable preference is Yes, a reason must be given"
], ],
"age1": [ "age1": ["Tenant age must be between 16 and 120"]
"Tenant age must be between 16 and 120"
]
} }
} }
} }
@ -247,9 +237,7 @@
"schema": { "schema": {
"type": "string", "type": "string",
"pattern": "application/json", "pattern": "application/json",
"enum": [ "enum": ["application/json"]
"application/json"
]
}, },
"in": "header", "in": "header",
"name": "Accept", "name": "Accept",
@ -430,12 +418,7 @@
"sex1": { "sex1": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1,
"enum": [ "enum": ["F: Female", "M:Male", "X:Non-binary", "R:Refused"],
"F: Female",
"M:Male",
"X:Non-binary",
"R:Refused"
],
"maxLength": 1 "maxLength": 1
}, },
"ethnic": { "ethnic": {

10
docs/app_api.md

@ -6,10 +6,10 @@ nav_order: 8
In order to use the app as an API, you will need to configure requests to the API as so: In order to use the app as an API, you will need to configure requests to the API as so:
* Configure your request with Basic Auth. Set the username to be the same as `API_USER` and password as the `API_KEY` (`API_USER` and `API_KEY` are environment variables that should be set for the application) - Configure your request with Basic Auth. Set the username to be the same as `API_USER` and password as the `API_KEY` (`API_USER` and `API_KEY` are environment variables that should be set for the application)
* Check the endpoint you are calling is an action that is `create`, `show` or `update` - Check the endpoint you are calling is an action that is `create`, `show` or `update`
* Check you are setting the following request headers: - Check you are setting the following request headers:
* `Content-Type = application/json` - `Content-Type = application/json`
* `Action = application/json` N.B. If you use `*/*` instead, the request won't be recognised as an API request` - `Action = application/json` N.B. If you use `*/*` instead, the request won't be recognised as an API request`
Currently only the logs controller is configured to accept and authenticate API requests, when the above API environment variables are set. Currently only the logs controller is configured to accept and authenticate API requests, when the above API environment variables are set.

8
docs/documentation_website.md

@ -7,13 +7,13 @@ nav_order: 11
The documentation website can be generated and run locally using Jekyll. The documentation website can be generated and run locally using Jekyll.
1. Change into the `/docs/` directory:\ 1. Change into the `/docs/` directory:\
`cd docs` `cd docs`
2. Install Jekyll and its dependencies:\ 2. Install Jekyll and its dependencies:\
`bundle install` `bundle install`
3. Start the Jekyll server:\ 3. Start the Jekyll server:\
`bundle exec jekyll serve` `bundle exec jekyll serve`
4. View the website:\ 4. View the website:\
<http://localhost:4000> <http://localhost:4000>

11
docs/infrastructure.md

@ -7,26 +7,32 @@ nav_order: 5
## Current infrastructure ## Current infrastructure
Currently, there are four environments with infrastructure: Currently, there are four environments with infrastructure:
- Meta - Meta
- Development (Review Apps) - Development (Review Apps)
- Staging - Staging
- Production - Production
### Meta ### Meta
This holds the Terraform “backend” and the ECR(s). This holds the Terraform “backend” and the ECR(s).
The Terraform “backend” consists of: The Terraform “backend” consists of:
- S3 buckets - for storing Terraform state files. One for all non-production environments (including the meta environment itself), and another just for production. - S3 buckets - for storing Terraform state files. One for all non-production environments (including the meta environment itself), and another just for production.
- DynamoDB - for managing access and locking of all state files. - DynamoDB - for managing access and locking of all state files.
The ECR(s) are: The ECR(s) are:
- core - holds the application Docker images. - core - holds the application Docker images.
- db-migration - holds the Docker images curated to help migrate a DB from PaaS to AWS. - db-migration - holds the Docker images curated to help migrate a DB from PaaS to AWS.
- s3-migration - holds the Docker images curated to help migrate S3 files from PaaS to AWS. - s3-migration - holds the Docker images curated to help migrate S3 files from PaaS to AWS.
N.B. the migration ECRs may or may not be present, depending on if the Terraform has been configured to create migration infrastructure. The migration infrastructure is only used to help migrate the DB and S3 from PaaS to AWS, so is usually therefore only temporarily present. N.B. the migration ECRs may or may not be present, depending on if the Terraform has been configured to create migration infrastructure. The migration infrastructure is only used to help migrate the DB and S3 from PaaS to AWS, so is usually therefore only temporarily present.
### Development / Staging / Production ### Development / Staging / Production
These are the main environments holding the “application” infrastructure. These are the main environments holding the “application” infrastructure.
Though not exhaustive, each of them will generally contain the following key components: Though not exhaustive, each of them will generally contain the following key components:
- ECS Fargate cluster - ECS Fargate cluster
- RDS (PostgreSQL database) - RDS (PostgreSQL database)
- ElastiCache (Redis data store) - ElastiCache (Redis data store)
@ -43,6 +49,7 @@ Though not exhaustive, each of them will generally contain the following key com
- WAF (Firewall) - WAF (Firewall)
### Development / Review Apps ### Development / Review Apps
The development environment is used for Review Apps, and has some infrastructure that is created per-review-app and some that is shared by all apps. The development environment is used for Review Apps, and has some infrastructure that is created per-review-app and some that is shared by all apps.
In general, each review app has its own ECS Fargate cluster and Redis instances (plus any infrastructure to enable this), while the rest is shared. In general, each review app has its own ECS Fargate cluster and Redis instances (plus any infrastructure to enable this), while the rest is shared.
@ -64,7 +71,6 @@ To deploy you need to:
6. Post success message on Slack. 6. Post success message on Slack.
7. Tag tickets as ‘Released’ and move tickets to done on JIRA. 7. Tag tickets as ‘Released’ and move tickets to done on JIRA.
## CI/CD ## CI/CD
When a commit is made to `main` the following GitHub action jobs are triggered: When a commit is made to `main` the following GitHub action jobs are triggered:
@ -95,6 +101,7 @@ One reason a review app deployment might fail is that it is attempting to run mi
## Destroying/recreating infrastructure ## Destroying/recreating infrastructure
Things to watch out for when destroying/creating infra: Things to watch out for when destroying/creating infra:
- All resources - All resources
- The lifecycle meta-argument prevent_destroy will stop you destroying things. Best to set this to false before trying to destroy! - The lifecycle meta-argument prevent_destroy will stop you destroying things. Best to set this to false before trying to destroy!
- Database - Database

13
docs/monitoring.md

@ -3,36 +3,46 @@ nav_order: 6
--- ---
# Logs and Debugging # Logs and Debugging
## Logs ## Logs
Logs can be found in two locations: Logs can be found in two locations:
- AWS CloudWatch (for general application / infrastructure logging) - AWS CloudWatch (for general application / infrastructure logging)
- Sentry (for application error logging) - Sentry (for application error logging)
### CloudWatch ### CloudWatch
The CloudWatch service can be accessed from the AWS Console. You should authenticate onto the infrastructure environment whose logs you want to check. The CloudWatch service can be accessed from the AWS Console. You should authenticate onto the infrastructure environment whose logs you want to check.
From CloudWatch, navigate to the desired log group (e.g. for the app task running on ECS) and open the desired log stream, in order to read its log “events”. From CloudWatch, navigate to the desired log group (e.g. for the app task running on ECS) and open the desired log stream, in order to read its log “events”.
Alternatively, you can also navigate to a specific AWS service / resource in question (e.g. ECS tasks), selecting the instance of interest (e.g. a specific ECS task), and finding the “logs” tab (or similar) to view the log “events”. Alternatively, you can also navigate to a specific AWS service / resource in question (e.g. ECS tasks), selecting the instance of interest (e.g. a specific ECS task), and finding the “logs” tab (or similar) to view the log “events”.
### Sentry ### Sentry
To access Sentry, ensure you have been added to the MHCLG account. To access Sentry, ensure you have been added to the MHCLG account.
Generally error logs in Sentry will also be present somewhere in the CloudWatch logs, but they will be easier to assess here (e.g. number of occurrences over a time period). The logs in Sentry are created by the application when it makes Rails.logger.error calls. Generally error logs in Sentry will also be present somewhere in the CloudWatch logs, but they will be easier to assess here (e.g. number of occurrences over a time period). The logs in Sentry are created by the application when it makes Rails.logger.error calls.
## Debugging ## Debugging
### Application infrastructure ### Application infrastructure
For debugging / investigating infrastructure issues you can use the AWS CloudWatch automatic dashboards. (e.g. is there a lack of physical space on the database, how long has the ECS had very high compute usage for etc.) For debugging / investigating infrastructure issues you can use the AWS CloudWatch automatic dashboards. (e.g. is there a lack of physical space on the database, how long has the ECS had very high compute usage for etc.)
They can be found in the CloudWatch service on AWS console, by going to dashboards → automatic dashboards, and selecting the desired dashboard (e.g. Elastic Container Service). They can be found in the CloudWatch service on AWS console, by going to dashboards → automatic dashboards, and selecting the desired dashboard (e.g. Elastic Container Service).
Alternatively, you can also navigate to the AWS resource in question (e.g. RDS database), selecting the instance of interest, and selecting the “monitoring” / ”metrics” tab (or similar), as this can provide alternate useful information also. Alternatively, you can also navigate to the AWS resource in question (e.g. RDS database), selecting the instance of interest, and selecting the “monitoring” / ”metrics” tab (or similar), as this can provide alternate useful information also.
### Exec into a container ### Exec into a container
You can open a terminal directly on a running container / app, in order to run some commands that may help with debugging an issue. You can open a terminal directly on a running container / app, in order to run some commands that may help with debugging an issue.
To do this, you will need to “exec” into the container. To do this, you will need to “exec” into the container.
#### Prerequisites #### Prerequisites
- AWS CLI - AWS CLI
- AWS Session manager plugin Install the Session Manager plugin for the AWS CLI - AWS Systems Manager - AWS Session manager plugin Install the Session Manager plugin for the AWS CLI - AWS Systems Manager
- AWS access - AWS access
#### Accessing the rails console #### Accessing the rails console
Prerequisite: Prerequisite:
Configure AWS auth following the [documentation in the infra repo](https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data-infrastructure/blob/main/docs/development_setup.md). This also details how to enter a subshell with suitable AWS credentials. Configure AWS auth following the [documentation in the infra repo](https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data-infrastructure/blob/main/docs/development_setup.md). This also details how to enter a subshell with suitable AWS credentials.
@ -51,8 +61,9 @@ env=staging
taskArns=$(aws ecs list-tasks --cluster "core-$env-app" --query "taskArns[*]") taskArns=$(aws ecs list-tasks --cluster "core-$env-app" --query "taskArns[*]")
aws ecs describe-tasks --cluster "core-$env-app" --tasks "${taskArns[@]}" --query "tasks[*].{arn:taskArn, status:lastStatus, startedAt:startedAt, group:group, image:containers[0].image}" --output text aws ecs describe-tasks --cluster "core-$env-app" --tasks "${taskArns[@]}" --query "tasks[*].{arn:taskArn, status:lastStatus, startedAt:startedAt, group:group, image:containers[0].image}" --output text
``` ```
You can then use `aws ecs execute-command --cluster "core-$env-app" --task <taskid> --interactive --command <command>` to run the relevant command on a specific task.
You can then use `aws ecs execute-command --cluster "core-$env-app" --task <taskid> --interactive --command <command>` to run the relevant command on a specific task.
### Database ### Database
In order to investigate or look more closely at the database, you can exec into a container as above, and use the rails console to query the database. In order to investigate or look more closely at the database, you can exec into a container as above, and use the rails console to query the database.

90
docs/setup.md

@ -18,6 +18,8 @@ We recommend using [RBenv](https://github.com/rbenv/rbenv) to manage Ruby versio
We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS versions. We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS versions.
## Pre-setup installation
1. Install PostgreSQL 1. Install PostgreSQL
macOS: macOS:
@ -75,6 +77,7 @@ We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS version
Note that we currently use node v16, which is no longer the latest LTS version so you will need to specify the version number when installing Note that we currently use node v16, which is no longer the latest LTS version so you will need to specify the version number when installing
macOS (using nvm): macOS (using nvm):
```bash ```bash
nvm install 16 nvm install 16
nvm use 16 nvm use 16
@ -94,7 +97,21 @@ We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS version
npm install --location=global yarn npm install --location=global yarn
``` ```
6. Clone the repo 6. (For running tests) Install Gecko Driver
Linux (Debian):
```bash
wget https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz
tar -xvzf geckodriver-v0.31.0-linux64.tar.gz
rm geckodriver-v0.31.0-linux64.tar.gz
chmod +x geckodriver
sudo mv geckodriver /usr/local/bin/
```
Also ensure you have firefox installed
7. Clone the repo
```bash ```bash
git clone https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data.git git clone https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data.git
@ -122,57 +139,60 @@ We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS version
bundle exec rake db:seed bundle exec rake db:seed
``` ```
5. Start the dev servers ## Running Locally
a. Using Foreman: ### Application
```bash Start the dev servers
./bin/dev
```
b. Individually: a. Using Foreman:
Rails: ```bash
./bin/dev
```
```bash b. Individually:
bundle exec rails s
```
JavaScript (for hot reloading): Rails:
```bash ```bash
yarn build --mode=development --watch bundle exec rails s
``` ```
If you’re not modifying front end assets you can bundle them as a one off task: JavaScript (for hot reloading):
```bash ```bash
yarn build --mode=development yarn build --mode=development --watch
``` ```
Development mode will target the latest versions of Chrome, Firefox and Safari for transpilation while production mode will target older browsers. If you’re not modifying front end assets you can bundle them as a one off task:
The Rails server will start on <http://localhost:3000>. ```bash
yarn build --mode=development
```
6. Install Gecko Driver Development mode will target the latest versions of Chrome, Firefox and Safari for transpilation while production mode will target older browsers.
Linux (Debian): The Rails server will start on <http://localhost:3000>.
```bash ### Tests
wget https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz
tar -xvzf geckodriver-v0.31.0-linux64.tar.gz
rm geckodriver-v0.31.0-linux64.tar.gz
chmod +x geckodriver
sudo mv geckodriver /usr/local/bin/
```
Running the test suite (front end assets need to be built or server needs to be running): ```bash
bundle exec rspec
```
```bash Or to run individual tests / files use your IDE
bundle exec rspec
``` ### Formatting
- `yarn prettier . --write` for scss, yml, md, and json files
- `yarn standard --fix` for js files
### Linting
Note that these tests assume you have firefox installed. ```bash
bundle exec rake lint
```
## Using Docker ## Using Docker

13
docs/testing.md

@ -33,50 +33,63 @@ RAILS_ENV=test bundle exec rake parallel:spec
``` ```
## Factories for Lettings Log, Sales Log, Organisation, and User ## Factories for Lettings Log, Sales Log, Organisation, and User
Each of these factories has nested relationships and callbacks that ensure associated objects are created and linked properly. For instance, creating a `lettings_log` involves creating or associating with a `user`, which in turn is linked to an `organisation`, potentially leading to creating `organisation_rent_periods` and a `data_protection_confirmation`. Each of these factories has nested relationships and callbacks that ensure associated objects are created and linked properly. For instance, creating a `lettings_log` involves creating or associating with a `user`, which in turn is linked to an `organisation`, potentially leading to creating `organisation_rent_periods` and a `data_protection_confirmation`.
This documentation outlines the objects that are created and/or persisted to the database when using FactoryBot to create or build models for LettingsLog, SalesLog, Organisation, and User. There are other factories, but they are simpler, less frequently used and don't have as much resource hierarchy. This documentation outlines the objects that are created and/or persisted to the database when using FactoryBot to create or build models for LettingsLog, SalesLog, Organisation, and User. There are other factories, but they are simpler, less frequently used and don't have as much resource hierarchy.
### Lettings Log ### Lettings Log
Objects Created/Persisted: Objects Created/Persisted:
- **User**: The `assigned_to` user is created. - **User**: The `assigned_to` user is created.
- **Organisation**: The `assigned_to` user’s organisation created by `User` factory. - **Organisation**: The `assigned_to` user’s organisation created by `User` factory.
- **DataProtectionConfirmation**: If `organisation` does not have DSA signed, `DataProtectionConfirmation` gets created with `assigned_to` user as a `data_protection_officer` - **DataProtectionConfirmation**: If `organisation` does not have DSA signed, `DataProtectionConfirmation` gets created with `assigned_to` user as a `data_protection_officer`
- **OrganisationRentPeriod**: If `log.period` is present and the `managing_organisation` does not have an `OrganisationRentPeriod` for that period, a new `OrganisationRentPeriod` is created and associated with `managing_organisation`. - **OrganisationRentPeriod**: If `log.period` is present and the `managing_organisation` does not have an `OrganisationRentPeriod` for that period, a new `OrganisationRentPeriod` is created and associated with `managing_organisation`.
Example Usage: Example Usage:
``` ```
let(:lettings_log) { create(:lettings_log) } let(:lettings_log) { create(:lettings_log) }
``` ```
### Sales Log ### Sales Log
Objects Created/Persisted: Objects Created/Persisted:
- **User**: The `assigned_to` user is created. - **User**: The `assigned_to` user is created.
- **Organisation**: The `assigned_to` user’s organisation created by `User` factory. - **Organisation**: The `assigned_to` user’s organisation created by `User` factory.
- **DataProtectionConfirmation**: If `organisation` does not have DSA signed, `DataProtectionConfirmation` gets created with `assigned_to` user as a `data_protection_officer` - **DataProtectionConfirmation**: If `organisation` does not have DSA signed, `DataProtectionConfirmation` gets created with `assigned_to` user as a `data_protection_officer`
Example Usage: Example Usage:
``` ```
let(:sales_log) { create(:sales_log) } let(:sales_log) { create(:sales_log) }
``` ```
### Organisation ### Organisation
Objects Created/Persisted: Objects Created/Persisted:
- **OrganisationRentPeriod**: For each rent period in transient attribute `rent_periods`, an `OrganisationRentPeriod` is created. - **OrganisationRentPeriod**: For each rent period in transient attribute `rent_periods`, an `OrganisationRentPeriod` is created.
- **DataProtectionConfirmation**: If `with_dsa` is `true` (default), a `DataProtectionConfirmation` is created with a `data_protection_officer` - **DataProtectionConfirmation**: If `with_dsa` is `true` (default), a `DataProtectionConfirmation` is created with a `data_protection_officer`
- **User**: Data protection officer that signs the data protection confirmation - **User**: Data protection officer that signs the data protection confirmation
Example Usage: Example Usage:
``` ```
let(:organisation) { create(:organisation, rent_periods: [1, 2])} let(:organisation) { create(:organisation, rent_periods: [1, 2])}
``` ```
### User ### User
Objects Created/Persisted: Objects Created/Persisted:
- **Organisation**: User’s organisation. - **Organisation**: User’s organisation.
- **DataProtectionConfirmation**: If `organisation` does not have DSA signed, `DataProtectionConfirmation` gets created with this user as a `data_protection_officer` - **DataProtectionConfirmation**: If `organisation` does not have DSA signed, `DataProtectionConfirmation` gets created with this user as a `data_protection_officer`
Example Usage: Example Usage:
``` ```
let(:user) { create(:user) } let(:user) { create(:user) }
``` ```

7
lib/tasks/lint.rake

@ -18,5 +18,10 @@ task stylelint: :environment do
sh "yarn stylelint app/frontend/styles" sh "yarn stylelint app/frontend/styles"
end end
desc "Run Prettier"
task prettier: :environment do
sh "yarn prettier . --check"
end
desc "Run all the linters" desc "Run all the linters"
task lint: %i[rubocop erblint standard stylelint] task lint: %i[rubocop erblint standard stylelint prettier]

5
package.json

@ -36,9 +36,10 @@
"version": "0.1.0", "version": "0.1.0",
"devDependencies": { "devDependencies": {
"are-you-es5": "^2.1.2", "are-you-es5": "^2.1.2",
"prettier": "3.3.3",
"standard": "^17.0.0", "standard": "^17.0.0",
"stylelint": "^15.10.1", "stylelint": "^16.8.2",
"stylelint-config-gds": "^0.2.0" "stylelint-config-gds": "^2.0.0"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [

58
spec/fixtures/forms/2021_2022.json vendored

@ -338,16 +338,16 @@
} }
}, },
"conditional_for": { "conditional_for": {
"leftreg": [ "leftreg": [1]
1
]
}, },
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"armedforces": 3 "armedforces": 3
}, },
"value": "Prefers not to say" "value": "Prefers not to say"
}] }
]
}, },
"leftreg": { "leftreg": {
"header": "Are they still serving?", "header": "Are they still serving?",
@ -512,9 +512,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"postcode_full": [ "postcode_full": [1]
1
]
}, },
"hidden_in_check_answers": true "hidden_in_check_answers": true
}, },
@ -530,12 +528,14 @@
"is_la_inferred": true "is_la_inferred": true
} }
}, },
"inferred_check_answers_value": [{ "inferred_check_answers_value": [
{
"condition": { "condition": {
"postcode_known": 0 "postcode_known": 0
}, },
"value": "Not known" "value": "Not known"
}] }
]
} }
} }
}, },
@ -789,7 +789,11 @@
} }
} }
}, },
"interruption_screen_question_ids": ["ecstat1", "incfreq", "earnings"] "interruption_screen_question_ids": [
"ecstat1",
"incfreq",
"earnings"
]
}, },
"net_income_uc_proportion": { "net_income_uc_proportion": {
"questions": { "questions": {
@ -838,9 +842,7 @@
} }
}, },
"conditional_for": { "conditional_for": {
"conditional_question": [ "conditional_question": [0]
0
]
} }
}, },
"conditional_question": { "conditional_question": {
@ -932,12 +934,7 @@
"min": 0, "min": 0,
"step": 0.01, "step": 0.01,
"width": 4, "width": 4,
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge" "result-field": "tcharge"
}, },
"scharge": { "scharge": {
@ -948,12 +945,7 @@
"min": 0, "min": 0,
"step": 0.01, "step": 0.01,
"width": 4, "width": 4,
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge" "result-field": "tcharge"
}, },
"pscharge": { "pscharge": {
@ -964,12 +956,7 @@
"min": 0, "min": 0,
"step": 0.01, "step": 0.01,
"width": 4, "width": 4,
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge" "result-field": "tcharge"
}, },
"supcharg": { "supcharg": {
@ -981,12 +968,7 @@
"max": 300, "max": 300,
"step": 0.01, "step": 0.01,
"width": 4, "width": 4,
"fields-to-add": [ "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
"brent",
"scharge",
"pscharge",
"supcharg"
],
"result-field": "tcharge" "result-field": "tcharge"
}, },
"tcharge": { "tcharge": {

4
spec/fixtures/forms/2022_2023.json vendored

@ -41,9 +41,7 @@
} }
} }
}, },
"depends_on": [ "depends_on": [false]
false
]
} }
}, },
"depends_on": [ "depends_on": [

4583
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save