Skip to content

Commit

Permalink
Rejig teacher training adviser flow to allow for primary candidates t…
Browse files Browse the repository at this point in the history
…o also get an adviser instead of stopping the flow
  • Loading branch information
StackedPancakez committed Nov 7, 2023
1 parent 8549a17 commit 3d20c1a
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ def optional?
end

def skipped?
Rails.logger.error "Skipped"
return true if super

has_teacher_id_step = other_step(:has_teacher_id)
has_teacher_id_skipped = has_teacher_id_step.skipped?
has_id = has_teacher_id_step.has_id
Rails.logger.error "#########################"
Rails.logger.error "has_teacher_id_skipped: #{has_teacher_id_skipped}"
Rails.logger.error "has_id: #{has_id}"

has_teacher_id_skipped || !has_id
end
Expand Down
15 changes: 0 additions & 15 deletions app/models/teacher_training_adviser/steps/primary_returner.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def reviewable_answers
end
end

def interested_in_primary?
preferred_education_phase_id == OPTIONS[:primary]
end

def returning_teacher?
other_step(:returning_teacher).returning_to_teaching
end
Expand Down
15 changes: 15 additions & 0 deletions app/models/teacher_training_adviser/steps/stage_taught.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module TeacherTrainingAdviser::Steps
class StageTaught < GITWizard::Step
attribute :stage_taught, :string

validates :stage_taught, inclusion: { in: ['primary', 'secondary'] }

def previous_stage_primary?
stage_taught == 'primary'
end

def skipped?
!other_step(:returning_teacher).returning_to_teaching
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def self.options
end

def skipped?
!other_step(:returning_teacher).returning_to_teaching
!other_step(:returning_teacher).returning_to_teaching ||
other_step(:stage_interested_teaching).interested_in_primary?
end

def reviewable_answers
Expand Down
3 changes: 2 additions & 1 deletion app/models/teacher_training_adviser/steps/subject_taught.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def self.options
end

def skipped?
!other_step(:returning_teacher).returning_to_teaching
!other_step(:returning_teacher).returning_to_teaching ||
other_step(:stage_taught).previous_stage_primary?
end

def reviewable_answers
Expand Down
8 changes: 4 additions & 4 deletions app/models/teacher_training_adviser/wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ class Wizard < ::GITWizard::Base
GITWizard::Steps::Authenticate,
Steps::AlreadySignedUp,
Steps::ReturningTeacher,
Steps::HasTeacherId,
Steps::PreviousTeacherId,
Steps::StageTaught,
Steps::SubjectTaught,
Steps::HaveADegree,
Steps::NoDegree,
Steps::StageOfDegree,
Steps::WhatSubjectDegree,
Steps::WhatDegreeClass,
Steps::StageInterestedTeaching,
Steps::PrimaryReturner,
Steps::GcseMathsEnglish,
Steps::RetakeGcseMathsEnglish,
Steps::GcseScience,
Steps::RetakeGcseScience,
Steps::QualificationRequired,
Steps::SubjectInterestedTeaching,
Steps::StartTeacherTraining,
Steps::HasTeacherId,
Steps::PreviousTeacherId,
Steps::SubjectTaught,
Steps::SubjectLikeToTeach,
Steps::DateOfBirth,
Steps::UkOrOverseas,
Expand Down
12 changes: 12 additions & 0 deletions app/views/teacher_training_adviser/steps/_has_teacher_id.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@
<%= f.govuk_radio_button :has_id, true, label: { text: 'Yes' }, link_errors: true %>
<%= f.govuk_radio_button :has_id, false, label: { text: 'No' }, link_errors: true %>
<% end %>

<details class="govuk-details" data-module="govuk-details">
<summary class="govuk-details__summary">
<span class="govuk-details__summary-text">
What is a teacher reference number (TRN)?
</span>
</summary>
<div class="govuk-details__text">
A TRN is a 7 digit number that you get if you hold qualified teacher status in England or Wales or you contribute to the Teachers' Pension Scheme.<br>
If you're eligible for a TRN in England, you should be allocated one automatically.
</div>
</details>
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,23 @@
<%= f.govuk_fieldset legend: { text: "What is your previous teacher reference number?", tag: "h1" } do %>
<%= f.govuk_text_field :teacher_id, width: 20 %>
<% end %>

<details class="govuk-details" data-module="govuk-details">
<summary class="govuk-details__summary">
<span class="govuk-details__summary-text">
How do I find my teacher reference number (TRN)?
</span>
</summary>
<div class="govuk-details__text">
Your TRN is sometime on your payslip, pension statement or teacher training records.<br>
Alternatively, you can find a lost TRN<br><br>
You'll be asked for your:
<ul>
<li>name</li>
<li>Date of birth</li>
<li>National Insurance number</li>
</ul>
<br><br>
If there's a match, you'll get your TRN straight away. If there's no match, or you don't have a National Insurance number, it might take up to 5 days to find your TRN.
</div>
</details>
15 changes: 0 additions & 15 deletions app/views/teacher_training_adviser/steps/_primary_returner.erb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<%= f.govuk_radio_buttons_fieldset(:stage_taught, inline: true, legend: { tag: "h1", text: "Which stage did you previously teach?" }) do %>
<%= f.govuk_radio_button :stage_taught, "primary", label: { text: 'Primary' }, link_errors: true %>
<%= f.govuk_radio_button :stage_taught, "secondary", label: { text: "Secondary" }, link_errors: true %>
<% end %>

0 comments on commit 3d20c1a

Please sign in to comment.