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

CST-2558: closing 2021 - add ect journey - take into account 2021 closing in cohort determination logic #4861

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
11 changes: 0 additions & 11 deletions app/forms/schools/add_participants/add_wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def self.steps
email
email_already_taken
start_date
start_term
cannot_add_registration_not_yet_open
cannot_add_yourself_as_ect
cannot_add_mentor_to_providers
Expand Down Expand Up @@ -96,16 +95,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

def sit_added_as_mentor?
participant_create_args[:email] == current_user.email
end
Expand Down
27 changes: 9 additions & 18 deletions app/forms/schools/add_participants/base_wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class BaseWizard
include Rails.application.routes.url_helpers

class AlreadyInitialised < StandardError; end

class InvalidStep < StandardError; end

attr_reader :current_step, :submitted_params, :data_store, :current_user, :participant_profile, :school
Expand All @@ -18,7 +19,7 @@ class InvalidStep < StandardError; end
delegate :return_point, :changing_answer?, :transfer?, :participant_type, :trn, :confirmed_trn, :date_of_birth,
:induction_start_date, :nino, :ect_participant?, :mentor_id, :continue_current_programme?, :participant_profile,
:mentor_participant?, :appropriate_body_confirmed?, :appropriate_body_id, :known_by_another_name?,
:was_withdrawn_participant?, :complete?, :start_date, :start_term, :last_visited_step,
:was_withdrawn_participant?, :complete?, :start_date, :last_visited_step,
:ect_mentor?, :join_school_programme, :join_school_programme?, :join_participant_cohort_school_programme?,
:join_current_cohort_school_programme?, :current_providers?, :previous_providers?, :providers_chosen?,
:full_name, to: :data_store
Expand Down Expand Up @@ -288,9 +289,9 @@ def existing_induction_record
def existing_participant_profile
@existing_participant_profile ||=
ParticipantProfile::ECF
.joins(:teacher_profile)
.where(teacher_profile: { trn: formatted_confirmed_trn })
.first
.joins(:teacher_profile)
.where(teacher_profile: { trn: formatted_confirmed_trn })
.first
end

def existing_user
Expand Down Expand Up @@ -327,9 +328,7 @@ 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
def automatically_assign_next_cohort?
(mentor_participant? || induction_start_date.blank?) && !Cohort.within_automatic_assignment_period?
end

Expand Down Expand Up @@ -467,21 +466,14 @@ def cohort_to_place_participant
if transfer?
existing_participant_cohort || existing_participant_profile&.schedule&.cohort
elsif ect_participant? && induction_start_date.present?
Cohort.containing_date(induction_start_date).tap do |cohort|
Cohort.for_induction_start_date(induction_start_date).tap do |cohort|
return Cohort.current if cohort.blank? || cohort.npq_plus_one_or_earlier?
return Cohort.active_registration_cohort if cohort.payments_frozen?
end
elsif Cohort.within_automatic_assignment_period?
# 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]
# we're in the registration window prior to 1/9 and chose autumn or spring the following year
Cohort.next
else
# default to now - but should ask the start_term question if not already asked
Cohort.current
Cohort.next
end
end

Expand Down Expand Up @@ -604,7 +596,6 @@ def reset_form
email
mentor_id
start_date
start_term
appropriate_body_id
appropriate_body_confirmed
continue_current_programme
Expand Down
6 changes: 4 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,10 @@ def next_step
end
elsif wizard.sit_adding_themself_as_mentor?
:yourself
elsif wizard.needs_to_confirm_start_term?
:start_term
elsif wizard.automatically_assign_next_cohort? && !Cohort.within_next_registration_period?
:cannot_add_registration_not_yet_open
elsif wizard.automatically_assign_next_cohort? && wizard.need_training_setup?
:need_training_setup
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 wizard.automatically_assign_next_cohort?
: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 wizard.automatically_assign_next_cohort? && !Cohort.within_next_registration_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
4 changes: 0 additions & 4 deletions app/services/form_data/add_participant_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ def induction_start_date
get_date :induction_start_date
end

def start_term
get :start_term
end

def start_date
get_date :start_date
end
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.

4 changes: 0 additions & 4 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,6 @@ en:
start_date:
blank: "Enter the teacher’s induction start date"
invalid: "Enter a valid start date"
schools/add_participants/wizard_steps/start_term_step:
attributes:
start_term:
inclusion: "Select the start you will start mentor training"
schools/add_participants/wizard_steps/joining_date_step:
attributes:
start_date:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
end

scenario "Induction tutor tries to add an ECT that's a mentor in another school" do
outside_auto_assignment_window do
inside_auto_assignment_window do
when_i_navigate_to_mentors_dashboard
when_i_click_to_add_a_new_mentor
then_i_should_be_on_the_who_to_add_page
Expand All @@ -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 All @@ -63,4 +59,36 @@
then_i_see_the_mentor_name
end
end

scenario "Induction tutor tries to add an ECT that's a mentor in another school outside auto assignment period" do
outside_auto_assignment_window do
when_i_navigate_to_mentors_dashboard
when_i_click_to_add_a_new_mentor
then_i_should_be_on_the_who_to_add_page

when_i_select_to_add_a "Mentor"
when_i_click_on_continue
then_i_am_taken_to_the_what_we_need_to_know_about_this_mentor_page

when_i_click_on_continue
then_i_am_taken_to_add_mentor_full_name_page

when_i_add_mentor_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
when_i_click_on_continue

then_i_see_i_cannot_add_participant_yet
end
end
end
Loading
Loading