Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change min age for kids authorization from 10 to 8 #527

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/services/census_kids_authorization_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
# to verify the citizen's residence.
class CensusKidsAuthorizationHandler < CensusAuthorizationHandler
def age_limit
errors.add(:date_of_birth, I18n.t("census_kids_authorization_handler.age_under", min_age: 10)) unless age && age >= 10
errors.add(:date_of_birth, I18n.t("census_kids_authorization_handler.age_under", min_age: 8)) unless age && age >= 8
end
end
2 changes: 1 addition & 1 deletion app/views/census_kids_authorization/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>

<div class="field date">
<%= form.date_select :date_of_birth, start_year: 20.years.ago.year, end_year: 10.years.ago.year, default: 12.years.ago, prompt: { day: t(".date_select.day"), month: t(".date_select.month"), year: t(".date_select.year") } %>
<%= form.date_select :date_of_birth, start_year: 20.years.ago.year, end_year: 8.years.ago.year, default: 12.years.ago, prompt: { day: t(".date_select.day"), month: t(".date_select.month"), year: t(".date_select.year") } %>
</div>

<div class="field">
Expand Down
4 changes: 2 additions & 2 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ ca:
gender: Sexe
postal_code: Codi postal
scope: Districte
name: El padró (majors de 10 anys)
name: El padró (majors de 8 anys)
budgets:
projects:
budget_confirm:
Expand Down Expand Up @@ -249,7 +249,7 @@ ca:
actions:
census16_authorization_handler: Verifica't amb el padró (16+)
census_authorization_handler: Verifica't amb el padró
census_kids_authorization_handler: Verifica't amb el padró (10+)
census_kids_authorization_handler: Verifica't amb el padró (8+)
census_sms_authorization_handler: Verifica't amb el padró i el teu mòbil
valid_auth: Valid auth
layouts:
Expand Down
4 changes: 2 additions & 2 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ es:
gender: Sexo
postal_code: Código postal
scope_id: Distrito
name: El padrón (mayores de 10 años)
name: El padrón (mayores de 8 años)
budgets:
projects:
budget_confirm:
Expand Down Expand Up @@ -243,7 +243,7 @@ es:
actions:
census16_authorization_handler: Verifícate con el padrón (16+)
census_authorization_handler: Verifícate con el padrón
census_kids_authorization_handler: Verifícate con el padrón (10+)
census_kids_authorization_handler: Verifícate con el padrón (8+)
layouts:
decidim:
initiative_header_steps:
Expand Down
4 changes: 2 additions & 2 deletions spec/services/census_kids_authorization_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
it { is_expected.not_to be_valid }
end

context "when it's under 10" do
let(:date_of_birth) { 9.years.ago }
context "when it's under 8" do
let(:date_of_birth) { 7.years.ago }

it { is_expected.not_to be_valid }
end
Expand Down
8 changes: 4 additions & 4 deletions spec/system/census_kids_authorization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def fill_in_authorization_form
end

click_link "Autoritzacions"
click_link "El padró (majors de 10 anys)"
click_link "El padró (majors de 8 anys)"

fill_in_authorization_form
click_button "Enviar"
Expand All @@ -62,8 +62,8 @@ def fill_in_authorization_form
visit decidim_verifications.authorizations_path

within ".authorizations-list" do
expect(page).to have_content("El padró (majors de 10 anys)")
expect(page).not_to have_link("El padró (majors de 10 anys)")
expect(page).to have_content("El padró (majors de 8 anys)")
expect(page).not_to have_link("El padró (majors de 8 anys)")
end
end

Expand All @@ -78,7 +78,7 @@ def fill_in_authorization_form
visit decidim_verifications.authorizations_path

within ".authorizations-list" do
expect(page).to have_content("El padró (majors de 10 anys)")
expect(page).to have_content("El padró (majors de 8 anys)")
expect(page).to have_content(I18n.l(authorization.granted_at, format: :long, locale: :ca))
end
end
Expand Down
Loading