Browse Source

Merge pull request #210 from communitiesuk/low-hanging-bugs

pull/211/head
Paul Robert Lloyd 3 years ago committed by GitHub
parent
commit
3d545cd454
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      app/models/constants/case_log.rb
  2. 6
      app/models/validations/household_validations.rb
  3. 1
      app/views/devise/confirmations/new.html.erb
  4. 3
      app/views/devise/passwords/new.html.erb
  5. 3
      app/views/devise/sessions/new.html.erb
  6. 3
      app/views/devise/unlocks/new.html.erb
  7. 2
      app/views/layouts/_footer.html.erb
  8. 2
      app/views/layouts/application.html.erb
  9. 4
      app/views/start/index.html.erb
  10. 3
      app/views/users/edit.html.erb
  11. 1
      app/views/users/new.html.erb
  12. 20
      config/forms/2021_2022.json
  13. 10
      docs/api/DLUHC-CORE-Data.v1.json
  14. 4
      spec/features/form/conditional_questions_spec.rb
  15. 6
      spec/fixtures/complete_case_log.json
  16. 8
      spec/fixtures/forms/2021_2022.json
  17. 8
      spec/fixtures/forms/2022_2023.json
  18. 6
      spec/models/case_log_spec.rb

10
app/models/constants/case_log.rb

@ -35,9 +35,9 @@ module Constants::CaseLog
}.freeze
ETHNIC = {
"White: English/Scottish/Welsh/Northern Irish/British" => 1,
"White: English, Welsh, Scottish, Northern Irish or British" => 1,
"White: Irish" => 2,
"White: Gypsy/Irish Traveller" => 18,
"White: Gypsy or Irish Traveller" => 18,
"White: Other" => 3,
"Mixed: White and Black Caribbean" => 4,
"Mixed: White and Black African" => 5,
@ -77,7 +77,7 @@ module Constants::CaseLog
NATIONAL = {
"UK national resident in UK" => 1,
"A current or former reserve in the UK Armed Forces (exc. National Service)" => 100,
"A current or former reserve in the UK Armed Forces (excluding National Service)" => 100,
"UK national returning from residence overseas" => 2,
"Czech Republic" => 3,
"Estonia" => 4,
@ -981,10 +981,10 @@ module Constants::CaseLog
}.freeze
ARMED_FORCES = {
"A current or former regular in the UK Armed Forces (exc. National Service)" => 1,
"A current or former regular in the UK Armed Forces (excluding National Service)" => 1,
"No" => 2,
"Tenant prefers not to say" => 3,
"A current or former reserve in the UK Armed Forces (exc. National Service)" => 4,
"A current or former reserve in the UK Armed Forces (excluding National Service)" => 4,
"A spouse / civil partner of a UK Armed Forces member who has separated or been bereaved within the last 2 years" => 5,
}.freeze

6
app/models/validations/household_validations.rb

@ -26,7 +26,7 @@ module Validations::HouseholdValidations
end
def validate_armed_forces_injured(record)
if (record.armedforces == "A current or former regular in the UK Armed Forces (exc. National Service)" || record.armedforces == "A current or former reserve in the UK Armed Forces (exc. National Service)") && record.reservist.blank?
if (record.armedforces == "A current or former regular in the UK Armed Forces (excluding National Service)" || record.armedforces == "A current or former reserve in the UK Armed Forces (excluding National Service)") && record.reservist.blank?
record.errors.add :reservist, "You must answer the armed forces injury question if the tenant has served in the armed forces"
end
@ -36,11 +36,11 @@ module Validations::HouseholdValidations
end
def validate_armed_forces_active_response(record)
if record.armedforces == "A current or former regular in the UK Armed Forces (exc. National Service)" && record.leftreg.blank?
if record.armedforces == "A current or former regular in the UK Armed Forces (excluding National Service)" && record.leftreg.blank?
record.errors.add :leftreg, "You must answer the armed forces active question if the tenant has served as a regular in the armed forces"
end
if record.armedforces != "A current or former regular in the UK Armed Forces (exc. National Service)" && record.leftreg.present?
if record.armedforces != "A current or former regular in the UK Armed Forces (excluding National Service)" && record.leftreg.present?
record.errors.add :leftreg, "You must not answer the armed forces active question if the tenant has not served as a regular in the armed forces"
end
end

1
app/views/devise/confirmations/new.html.erb

@ -6,6 +6,7 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email",
spellcheck: "false",
value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email)
%>

3
app/views/devise/passwords/new.html.erb

@ -21,7 +21,8 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email"
autocomplete: "email",
spellcheck: "false"
%>
<%= f.govuk_submit "Send email" %>

3
app/views/devise/sessions/new.html.erb

@ -12,7 +12,8 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email"
autocomplete: "email",
spellcheck: "false"
%>
<%= f.govuk_password_field :password,

3
app/views/devise/unlocks/new.html.erb

@ -5,7 +5,8 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email"
autocomplete: "email",
spellcheck: "false"
%>
<%= f.govuk_submit "Resend unlock instructions" %>

2
app/views/layouts/_footer.html.erb

@ -16,7 +16,7 @@
<h3 class="govuk-heading-s govuk-!-margin-bottom-1">Email</h3>
<ul class="govuk-list govuk-!-font-size-16 govuk-!-margin-bottom-0">
<li>
<a class="govuk-link govuk-footer__link" href="mailto:mhclg.digital-services@communities.gov.uk?subject=CORE">dluhc.digital-services@communities.gov.uk</a>
<%= govuk_mail_to("submitcoredata@communities.gov.uk", class: "govuk-footer__link") %>
</li>
<li class="govuk-!-margin-bottom-0">We aim to respond within 2 working days</li>
</ul>

2
app/views/layouts/application.html.erb

@ -54,7 +54,7 @@
<div class="govuk-width-container">
<%= govuk_phase_banner(
tag: { text: 'Beta' },
text: "This is a new service – #{govuk_mail_to("test@mhclg.gov.uk", "give feedback or report a problem", subject: "Feedback about Lettings and Sales of Social Housing in England Data Collection")}".html_safe
text: "This is a new service – #{govuk_mail_to("submitcoredata@communities.gov.uk", "give feedback or report a problem", subject: "Feedback about #{t('service_name')}")}".html_safe
) %>
<%= content_for(:breadcrumbs) %>

4
app/views/start/index.html.erb

@ -5,13 +5,13 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<p class="govuk-body">Use this service to submit social housing lettings and sales data to the Department for Levelling Up, Housing and Communities (DLUHC).</p>
<p class="govuk-body">We’ll ask you questions about a sale or letting, like details about the household or property. Your answers will create a log that you can submit directly to us.</p>
<p class="govuk-body">We’ll ask you questions about a letting or sale, like details about the household or property. Your answers will create a log that you can submit directly to us.</p>
<p class="govuk-body">Your organisation can also:</p>
<ul class="govuk-list govuk-list--bullet">
<li>upload data for multiple sales and lettings</li>
<li>transfer data using an API</li>
<%# TODO: Add link to lettings log form %>
<li><%= govuk_link_to("download a copy of the 2021 to 2022 lettings log as a PDF", "https://digital.dclg.gov.uk/jira/servicedesk/customer/portal/4/group/21") %> (2MB)</li>
<li><%= govuk_link_to("download a copy of the 2021 to 2022 lettings log as a PDF", "#") %> (2MB)</li>
</ul>
<p class="govuk-body">The data will be used to update the national record for social housing. It will also help to inform policy about the cost of social housing and what type of housing needs to be built.</p>
<p class="govuk-body">This service is only for social housing in England.</p>

3
app/views/users/edit.html.erb

@ -22,7 +22,8 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email"
autocomplete: "email",
spellcheck: "false"
%>
<%= f.govuk_submit "Save changes" %>

1
app/views/users/new.html.erb

@ -23,6 +23,7 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email",
spellcheck: "false",
value: @resource.email
%>

20
config/forms/2021_2022.json

@ -65,13 +65,13 @@
"description": "",
"questions": {
"sale_or_letting": {
"check_answer_label": "Sale or letting",
"header": "Is this a sale or a letting?",
"check_answer_label": "Letting or sale",
"header": "Is this a letting or sale?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "Sale",
"1": "Letting"
"1": "Letting",
"0": "Sale"
}
}
},
@ -276,9 +276,9 @@
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "White: English/Scottish/Welsh/Northern Irish/British",
"0": "White: English, Welsh, Scottish, Northern Irish or British",
"1": "White: Irish",
"2": "White: Gypsy/Irish Traveller",
"2": "White: Gypsy or Irish Traveller",
"3": "White: Other",
"4": "Mixed: White and Black Caribbean",
"5": "Mixed: White and Black African",
@ -919,18 +919,18 @@
"type": "radio",
"check_answer_label": "Armed Forces",
"answer_options": {
"0": "A current or former regular in the UK Armed Forces (exc. National Service)",
"1": "A current or former reserve in the UK Armed Forces (exc. National Service)",
"0": "A current or former regular in the UK Armed Forces (excluding National Service)",
"1": "A current or former reserve in the UK Armed Forces (excluding National Service)",
"2": "A spouse / civil partner of a UK Armed Forces member who has separated or been bereaved within the last 2 years",
"3": "No",
"4": "Tenant prefers not to say"
},
"conditional_for": {
"leftreg": [
"A current or former regular in the UK Armed Forces (exc. National Service)"
"A current or former regular in the UK Armed Forces (excluding National Service)"
],
"reservist": [
"A current or former regular in the UK Armed Forces (exc. National Service)"
"A current or former regular in the UK Armed Forces (excluding National Service)"
]
}
},

10
docs/api/DLUHC-CORE-Data.v1.json

@ -258,10 +258,10 @@
"tenant_code": "T657",
"age1": 35,
"sex1": "Female",
"ethnic": "White: English/Scottish/Welsh/Northern Irish/British",
"ethnic": "White: English, Welsh, Scottish, Northern Irish or British",
"national": "UK national resident in UK",
"prevten": "Private sector tenancy",
"armedforces": "A current or former regular in the UK Armed Forces (exc. National Service)",
"armedforces": "A current or former regular in the UK Armed Forces (excluding National Service)",
"ecstat1": "Full-time - 30 hours or more",
"other_hhmemb": 7,
"relat2": "Partner",
@ -389,9 +389,9 @@
"type": "string",
"minLength": 1,
"enum": [
"White: English/Scottish/Welsh/Northern Irish/British",
"White: English, Welsh, Scottish, Northern Irish or British",
"White: Irish",
"White: Gypsy/Irish Traveller",
"White: Gypsy or Irish Traveller",
"White: Other",
"Mixed: White and Black Caribbean",
"Mixed: White and Black African",
@ -415,7 +415,7 @@
"minLength": 1,
"enum": [
"UK national resident in UK",
"A current or former reserve in the UK Armed Forces (exc. National Service)",
"A current or former reserve in the UK Armed Forces (excluding National Service)",
"UK national returning from residence overseas",
"Czech Republic",
"Estonia",

4
spec/features/form/conditional_questions_spec.rb

@ -29,13 +29,13 @@ RSpec.describe "Form Conditional Questions" do
it "shows conditional questions if the required answer is selected and hides it again when a different answer option is selected", js: true do
visit("/logs/#{id}/armed-forces")
# Something about our styling makes the selenium webdriver think the actual radio buttons are not visible so we allow label click here
choose("case-log-armedforces-a-current-or-former-regular-in-the-uk-armed-forces-exc-national-service-field", allow_label_click: true)
choose("case-log-armedforces-a-current-or-former-regular-in-the-uk-armed-forces-excluding-national-service-field", allow_label_click: true)
expect(page).to have_selector("#reservist_div")
choose("case-log-reservist-no-field", allow_label_click: true)
expect(page).to have_checked_field("case-log-reservist-no-field", visible: false)
choose("case-log-armedforces-no-field", allow_label_click: true)
expect(page).not_to have_selector("#reservist_div")
choose("case-log-armedforces-a-current-or-former-regular-in-the-uk-armed-forces-exc-national-service-field", allow_label_click: true)
choose("case-log-armedforces-a-current-or-former-regular-in-the-uk-armed-forces-excluding-national-service-field", allow_label_click: true)
expect(page).to have_unchecked_field("case-log-reservist-no-field", visible: false)
end
end

6
spec/fixtures/complete_case_log.json vendored

@ -3,11 +3,11 @@
"tenant_code": "T657",
"age1": 35,
"sex1": "Female",
"ethnic": "White: English/Scottish/Welsh/Northern Irish/British",
"ethnic": "White: English, Welsh, Scottish, Northern Irish or British",
"national": "UK national resident in UK",
"prevten": "Private sector tenancy",
"armedforces": "A current or former regular in the UK Armed Forces (exc. National Service)",
"armed_forces": "A current or former regular in the UK Armed Forces (exc. National Service)",
"armedforces": "A current or former regular in the UK Armed Forces (excluding National Service)",
"armed_forces": "A current or former regular in the UK Armed Forces (excluding National Service)",
"armed_forces_partner": "",
"ecstat1": "Full-time - 30 hours or more",
"other_hhmemb": 7,

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

@ -117,15 +117,15 @@
"type": "radio",
"check_answer_label": "Armed Forces",
"answer_options": {
"0":"A current or former regular in the UK Armed Forces (exc. National Service)",
"1":"A current or former reserve in the UK Armed Forces (exc. National Service)",
"0":"A current or former regular in the UK Armed Forces (excluding National Service)",
"1":"A current or former reserve in the UK Armed Forces (excluding National Service)",
"2": "A spouse / civil partner of a UK Armed Forces member who has separated or been bereaved within the last 2 years",
"3": "No",
"4": "Tenant prefers not to say"
},
"conditional_for": {
"leftreg": ["A current or former regular in the UK Armed Forces (exc. National Service)"],
"reservist": ["A current or former regular in the UK Armed Forces (exc. National Service)"]
"leftreg": ["A current or former regular in the UK Armed Forces (excluding National Service)"],
"reservist": ["A current or former regular in the UK Armed Forces (excluding National Service)"]
}
},
"leftreg": {

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

@ -36,13 +36,13 @@
"description": "",
"questions": {
"sale_or_letting": {
"check_answer_label": "Sale or letting",
"header": "Is this a sale or a letting?",
"check_answer_label": "Letting or sale",
"header": "Is this a letting or sale?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "Sale",
"1": "Letting"
"1": "Letting",
"0": "Sale"
}
}
},

6
spec/models/case_log_spec.rb

@ -185,7 +185,7 @@ RSpec.describe Form, type: :model do
context "armed forces injured validation" do
it "must be answered if tenant was a regular or reserve in armed forces" do
expect {
CaseLog.create!(armedforces: "A current or former regular in the UK Armed Forces (exc. National Service)",
CaseLog.create!(armedforces: "A current or former regular in the UK Armed Forces (excluding National Service)",
reservist: nil,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
@ -507,7 +507,7 @@ RSpec.describe Form, type: :model do
context "armed forces active validation" do
it "must be answered if ever served in the forces as a regular" do
expect {
CaseLog.create!(armedforces: "A current or former regular in the UK Armed Forces (exc. National Service)",
CaseLog.create!(armedforces: "A current or former regular in the UK Armed Forces (excluding National Service)",
leftreg: nil,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
@ -526,7 +526,7 @@ RSpec.describe Form, type: :model do
# Crossover over tests here as injured must be answered as well for no error
it "must be answered if ever served in the forces as a regular" do
expect do
CaseLog.create!(armedforces: "A current or former regular in the UK Armed Forces (exc. National Service)",
CaseLog.create!(armedforces: "A current or former regular in the UK Armed Forces (excluding National Service)",
leftreg: "Yes",
reservist: "Yes",
owning_organisation: owning_organisation,

Loading…
Cancel
Save