Skip to content

Commit

Permalink
Skip start term step in next cohort registration period
Browse files Browse the repository at this point in the history
When a participant has no induction start date from DQT and the current date is within the registration window for the next cohort, automatically assign them.
  • Loading branch information
steventux committed May 29, 2024
1 parent 23eba39 commit 73ead29
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 176 deletions.
6 changes: 0 additions & 6 deletions app/forms/schools/add_participants/add_wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ def needs_to_choose_partnership?
mentor_participant? && ([lead_provider, delivery_partner].all? || previous_providers_training_on_current_cohort?)
end

# only relevant when we are in the registration period before the next cohort starts
# and the participant doesn't have an induction start date registered with DQT
def show_start_term?
(mentor_participant? || induction_start_date.blank?) && start_term.present?
end

def start_term_description
"#{start_term.capitalize} #{start_term == 'spring' ? Time.zone.now.year + 1 : Time.zone.now.year}"
end
Expand Down
12 changes: 2 additions & 10 deletions app/forms/schools/add_participants/base_wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,6 @@ def same_delivery_partner?
false
end

def needs_to_confirm_start_term?
# are we in the next registration period (or pre-registration period) and the participant does not have
# an induction start date
(mentor_participant? || induction_start_date.blank?) && !Cohort.within_automatic_assignment_period?
end

## appropriate bodies
def needs_to_confirm_appropriate_body?
# Slim possiblity that school_cohort could be nil early on
Expand Down Expand Up @@ -470,13 +464,11 @@ def cohort_to_place_participant
Cohort.containing_date(induction_start_date).tap do |cohort|
return Cohort.current if cohort.blank? || cohort.npq_plus_one_or_earlier?
end
elsif Cohort.within_automatic_assignment_period?
elsif Cohort.within_automatic_assignment_period? || start_term == "summer"
# true from 1/9 to end of automatic assignment period
Cohort.current
elsif start_term == "summer"
Cohort.current
# we're in the registration window prior to 1/9
elsif start_term.in? %w[autumn spring]
elsif start_term.in?(%w[autumn spring]) || induction_start_date.blank?
# we're in the registration window prior to 1/9 and chose autumn or spring the following year
Cohort.next
else
Expand Down
4 changes: 2 additions & 2 deletions app/forms/schools/add_participants/wizard_steps/email_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def next_step
end
elsif wizard.sit_adding_themself_as_mentor?
:yourself
elsif wizard.needs_to_confirm_start_term?
:start_term
elsif !Cohort.within_next_registration_period? && !Cohort.within_automatic_assignment_period?
:cannot_add_registration_not_yet_open
elsif wizard.needs_to_choose_a_mentor?
:choose_mentor
elsif wizard.needs_to_confirm_appropriate_body?
Expand Down
64 changes: 0 additions & 64 deletions app/forms/schools/add_participants/wizard_steps/start_term_step.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def transfer_step_for_type
end

def cohort_checks
if wizard.needs_to_confirm_start_term?
# we're not sure at this point which cohort is needed
# so allow to proceed at this point
if !Cohort.within_automatic_assignment_period?
:none
elsif !wizard.registration_open_for_participant_cohort?
# we know the cohort at this point (only if induction start date set)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def next_step
else
:cannot_add_manual_transfer
end
elsif wizard.needs_to_confirm_start_term?
:start_term
elsif !Cohort.within_next_registration_period? && !Cohort.within_automatic_assignment_period?
:cannot_add_registration_not_yet_open
elsif wizard.needs_to_choose_a_mentor?
:choose_mentor
elsif wizard.needs_to_confirm_appropriate_body?
Expand Down
10 changes: 0 additions & 10 deletions app/views/schools/add_participants/_ect_or_mentor_answers.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@
href: form.change_path_for(step: :email)) %>
<% end %>

<% if form.show_start_term? %>
<% summary_list.with_row do |row| %>
<% row.with_key { "Start term" } %>
<% row.with_value { form.start_term_description } %>
<% row.with_action(text: "Change",
visually_hidden_text: "start term",
href: form.change_path_for(step: :start_term)) %>
<% end %>
<% end %>

<% if form.ect_participant? %>
<% summary_list.with_row do |row| %>
<% row.with_key { "Mentor" } %>
Expand Down
31 changes: 0 additions & 31 deletions app/views/schools/add_participants/start_term.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@

when_i_add_ect_or_mentor_email
when_i_click_on_continue
then_i_am_taken_to_mentor_start_training_page

when_i_choose_summer_term_this_cohort
when_i_click_on_continue
then_i_am_taken_to_choose_mentor_partnership_page

when_i_choose_current_providers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
and_i_go_through_the_what_we_need_from_you_page

and_i_fill_in_all_info
then_i_am_taken_to_mentor_start_training_page

when_i_choose_summer_term_this_cohort
when_i_click_on_continue
then_i_am_taken_to_choose_mentor_partnership_page

Expand Down Expand Up @@ -106,9 +103,6 @@
and_i_go_through_the_what_we_need_from_you_page

and_i_fill_in_all_info
then_i_am_taken_to_mentor_start_training_page

when_i_choose_summer_term_this_cohort
when_i_click_on_continue
then_i_am_taken_to_choose_mentor_partnership_page

Expand Down Expand Up @@ -140,9 +134,6 @@
and_i_go_through_the_what_we_need_from_you_page

and_i_fill_in_all_info(email: new_email)
then_i_am_taken_to_mentor_start_training_page

when_i_choose_summer_term_this_cohort
when_i_click_on_continue
then_i_am_taken_to_choose_mentor_partnership_page

Expand Down Expand Up @@ -172,9 +163,6 @@
and_i_go_through_the_what_we_need_from_you_page

and_i_fill_in_all_info
then_i_am_taken_to_mentor_start_training_page

when_i_choose_summer_term_this_cohort
when_i_click_on_continue
then_i_am_taken_to_choose_mentor_partnership_page

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ def initialize(day, month, year)
when_i_add_email_address_to_the_school_add_participant_wizard "Sally Teacher", participant_data[:email]
then_the_page_is_accessible

when_i_choose_summer_term_on_the_school_add_participant_wizard
then_the_page_is_accessible

when_i_choose_current_providers_on_the_school_add_participant_wizard
then_the_page_is_accessible

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@
then_i_am_taken_to_add_yourself_as_mentor_confirmation_page

when_i_click_on_confirm
then_i_am_taken_to_sit_mentor_start_training_page

when_i_choose_summer_term_this_cohort
and_i_click_on_continue
then_i_am_taken_to_choose_mentor_partnership_page

when_i_choose_current_providers
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# frozen_string_literal: true

require "rails_helper"
require_relative "../../training_dashboard/manage_training_steps"

RSpec.describe "SIT adds ECT participant", js: true do
include ManageTrainingSteps

before do
inside_registration_window do
set_participant_data
given_there_is_a_school_that_has_chosen_fip_for_current_and_next_cohorts_and_partnered
and_i_am_signed_in_as_an_induction_coordinator
and_i_click_on(Cohort.current.description)
then_i_am_taken_to_fip_induction_dashboard

set_dqt_validation_result
end
end

scenario "Participant doesn't have an induction start date" do
inside_registration_window do
when_i_navigate_to_ect_dashboard
when_i_click_to_add_a_new_ect
then_i_should_be_on_the_who_to_add_page

when_i_select_to_add_a "ECT"
when_i_click_on_continue

then_i_am_taken_to_the_what_we_need_from_you_page

when_i_click_on_continue
then_i_am_taken_to_add_ect_name_page

when_i_add_ect_name
when_i_click_on_continue
then_i_am_taken_to_add_teachers_trn_page

when_i_add_the_trn
when_i_click_on_continue
then_i_am_taken_to_add_date_of_birth_page

when_i_add_a_date_of_birth
when_i_click_on_continue
then_i_am_taken_to_add_ect_or_mentor_email_page

when_i_add_ect_or_mentor_email(email: @participant_data[:email])
when_i_click_on_continue

when_i_click_confirm_and_add
then_i_am_taken_to_the_confirmation_page
and_the_participant_has_been_added_to_the_next_cohort
end
end

def given_there_is_a_school_that_has_chosen_fip_for_current_and_next_cohorts_and_partnered
given_there_is_a_school_that_has_chosen_fip_for_previous_and_current_cohort_and_partnered
@cohort_next = Cohort.next || create(:cohort, :next)
@school_cohort_next = create(:school_cohort, :fip, school: @school, cohort: @cohort_next)
@induction_programme_next = create(:induction_programme, :fip, school_cohort: @school_cohort_next, partnership: @partnership_current)
@school_cohort_next.update!(default_induction_programme: @induction_programme_next)
end

def then_i_am_taken_to_the_confirmation_page
expect(page).to have_content("#{@participant_data[:full_name]} has been added as an ECT")
end

def and_the_participant_has_been_added_to_the_next_cohort
expect(@school.ecf_participant_profiles.last.school_cohort).to eq(@school_cohort_next)
end

def set_participant_data
@participant_data = {
trn: "1234567",
full_name: "Sally Teacher",
date_of_birth: Date.new(1998, 3, 22),
email: "[email protected]",
nino: "AB123456A",
start_date: nil,
start_term: nil,
}
end
end
Loading

0 comments on commit 73ead29

Please sign in to comment.