Skip to content

Commit

Permalink
Rename consent school step
Browse files Browse the repository at this point in the history
The school step is being split in to two separate steps (first to
confirm if the school is correct, second is to choose a different school
if it's not). This change renames the `school` step to `confirm_school`
and I anticipate adding a `different_school` step for when we want to
choose a school.
  • Loading branch information
thomasleese committed Sep 25, 2024
1 parent 27dd4fd commit 0595cd4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def update
model.assign_attributes(update_params)
end

if current_step == :school && @consent_form.is_this_their_school == "no"
if current_step == :confirm_school &&
@consent_form.is_this_their_school == "no"
redirect_to session_parent_interface_consent_form_cannot_consent_school_path(
@session,
@consent_form
Expand Down Expand Up @@ -72,7 +73,7 @@ def update_params
date_of_birth(2i)
date_of_birth(1i)
],
school: %i[is_this_their_school],
confirm_school: %i[is_this_their_school],
parent: %i[
parent_email
parent_name
Expand Down
4 changes: 2 additions & 2 deletions app/models/consent_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class ConsentForm < ApplicationRecord
}
end

on_wizard_step :school, exact: true do
on_wizard_step :confirm_school, exact: true do
validates :is_this_their_school, inclusion: { in: %w[yes no] }
end

Expand Down Expand Up @@ -238,7 +238,7 @@ def wizard_steps
[
:name,
:date_of_birth,
:school,
:confirm_school,
:parent,
(:contact_method if parent_phone.present?),
:consent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% content_for :before_main do %>
<%= render AppBacklinkComponent.new(
href: session_parent_interface_consent_form_edit_path(@session, @consent_form, :school),
href: session_parent_interface_consent_form_edit_path(@session, @consent_form, "confirm-school"),
name: "edit school page",
) %>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ en:
batch: batch
cohort: cohort
confirm: confirm
confirm_school: confirm-school
consent: consent
contact_method: contact-method
date_of_birth: date-of-birth
Expand Down
4 changes: 2 additions & 2 deletions spec/models/consent_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
# .on(:update) }
end

context "when wizard_step is :school" do
let(:wizard_step) { :school }
context "when wizard_step is :confirm_school" do
let(:wizard_step) { :confirm_school }

context "runs validations from previous steps" do
it { should validate_presence_of(:first_name).on(:update) }
Expand Down

0 comments on commit 0595cd4

Please sign in to comment.