Skip to content

Commit

Permalink
Merge pull request #9913 from DFE-Digital/2498-remove-the-tda-feature…
Browse files Browse the repository at this point in the history
…-flag-from-apply-manage

Remove teacher degree apprenticeship feature flag code
  • Loading branch information
tomas-stefano authored Oct 11, 2024
2 parents 27526d2 + b5a3488 commit 54617ba
Show file tree
Hide file tree
Showing 43 changed files with 91 additions and 466 deletions.
19 changes: 7 additions & 12 deletions app/components/candidate_interface/degree_empty_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<% if @application_form.teacher_degree_apprenticeship_feature_active? %>
<h2 class="govuk-heading-s"><%= t('.postgraduate.name') %></h2>
<h2 class="govuk-heading-s"><%= t('.postgraduate.name') %></h2>

<p class="govuk-body"><%= t('.postgraduate.bachelor_degree') %></p>
<p class="govuk-body"><%= t('.postgraduate.add_bachelor_degree') %></p>
<p class="govuk-body"><%= t('.postgraduate.bachelor_degree') %></p>
<p class="govuk-body"><%= t('.postgraduate.add_bachelor_degree') %></p>

<h2 class="govuk-heading-s"><%= t('.undergraduate.name') %></h2>
<h2 class="govuk-heading-s"><%= t('.undergraduate.name') %></h2>

<p class="govuk-body">
<%= t('.undergraduate.bachelor_degree_html', link: govuk_link_to(t('.undergraduate.teacher_degree_apprenticeship'), t('get_into_teaching.url_teacher_degree_apprenticeship'))) %>
</p>
<% else %>
<p class="govuk-body"><%= t('.postgraduate.bachelor_degree') %></p>
<p class="govuk-body"><%= t('.postgraduate.add_bachelor_degree') %></p>
<% end %>
<p class="govuk-body">
<%= t('.undergraduate.bachelor_degree_html', link: govuk_link_to(t('.undergraduate.teacher_degree_apprenticeship'), t('get_into_teaching.url_teacher_degree_apprenticeship'))) %>
</p>

<% unless @application_form.no_degree_and_degree_completed? %>
<%= govuk_button_link_to degrees.empty? ? t('application_form.degree.add.button') : t('application_form.degree.another.button'), candidate_interface_degree_country_path, primary: true %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@
<% else %>
<% if @editable %>
<%= govuk_inset_text(classes: 'govuk-!-width-two-thirds govuk-!-margin-top-0') do %>
<% if application_form.teacher_degree_apprenticeship_feature_active? %>
<p class="govuk-body"><%= t('.a_levels_are_required') %></p>
<p class="govuk-body"><%= t('.a_levels_postgraduate_or_undergraduate') %></p>
<% else %>
<p class="govuk-body"><%= t('.a_levels_postgraduate') %></p>
<p class="govuk-body"><%= t('.training_providers') %></p>
<% end %>
<p class="govuk-body"><%= t('.a_levels_are_required') %></p>
<p class="govuk-body"><%= t('.a_levels_postgraduate_or_undergraduate') %></p>

<%= govuk_button_link_to t('application_form.other_qualification.first.button'),
candidate_interface_other_qualification_type_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def check_cookie_preferences
end
end

delegate :teacher_degree_apprenticeship_feature_active?, to: :current_application
helper_method :teacher_degree_apprenticeship_feature_active?

def choices_controller?
ChoicesControllerMatcher.choices_controller?(current_application: current_application, controller_path: controller_path, request: request)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def destroy
current_application.update!(degrees_completed: nil)
@wizard.clear_state!

return redirect_to candidate_interface_details_path if teacher_degree_apprenticeship_feature_active?
return redirect_to candidate_interface_details_path
end
redirect_to candidate_interface_degree_review_path
end
Expand Down
4 changes: 0 additions & 4 deletions app/models/application_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,6 @@ def by_section(*sections)
module_function :by_column, :by_section
end

def teacher_degree_apprenticeship_feature_active?
FeatureFlag.active?(:teacher_degree_apprenticeship) && recruitment_cycle_year >= 2025
end

def no_degree_and_degree_not_completed?
no_degrees? && !degrees_completed?
end
Expand Down
2 changes: 0 additions & 2 deletions app/models/provider_interface/provider_applications_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ def status_filter
end

def course_type_filter
return unless FeatureFlag.active?(:teacher_degree_apprenticeship)

{
type: :checkboxes,
heading: I18n.t('provider_interface.filters.course_type.heading'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class ApplicationFormPresenter
:phase,
:personal_details_completed,
:no_degree_and_degree_not_completed?,
:teacher_degree_apprenticeship_feature_active?,
:support_reference, to: :application_form

def initialize(application_form)
Expand Down Expand Up @@ -199,7 +198,7 @@ def work_experience_path(params = nil)
end

def degrees_path
if no_degree_and_degree_not_completed? && teacher_degree_apprenticeship_feature_active?
if no_degree_and_degree_not_completed?
Rails.application.routes.url_helpers.candidate_interface_degree_university_degree_path
else
Rails.application.routes.url_helpers.candidate_interface_degree_review_path
Expand Down
1 change: 0 additions & 1 deletion app/services/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def feature
[:sample_applications_factory, 'An alternate generator for test/sample applications, uses `SampleApplicationsFactory` in place of `TestApplications.new`', 'Elliot Crosby-McCullough + Tomas Destefi'],
[:structured_reference_condition, 'Structured reference condition that can be added as a condition to an offer', 'Tomas Destefi'],
[:continuous_applications, 'The new continuous applications flow', 'James Glenn'],
[:teacher_degree_apprenticeship, 'The degree apprenticeship program', 'Tomas Destefi'],
[:block_provider_activity_log, 'Block provider activity log if causing problems', 'Lori Bailey'],
[:block_candidate_sign_in, 'Blocking candidate sign in, used if we are reaching rate limits in Notify', 'Lori Bailey'],
].freeze
Expand Down
2 changes: 1 addition & 1 deletion app/services/sample_applications_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create_application(states:, courses_to_apply_to:, recruitment_cycle_year: Cy
form_options[:references_completed] = true if states.include?(:unsubmitted_with_completed_references)
form_options[:submitted_at] = nil if states.uniq.difference(%i[unsubmitted unsubmitted_with_completed_references]).blank?

form = Satisfactory.root.add(:application_form, **form_options).which_is(:completed)
form = Satisfactory.root.add(:application_form, **form_options).which_is(:completed).which_is(:with_bachelor_degree)
form = form.which_is(:apply_again) if apply_again
form = form.which_is(:carry_over) if carry_over

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class IncompletePostgraduateCourseDetailsValidator < ActiveModel::EachValidator
include GovukVisuallyHiddenHelper

def validate_each(record, attribute, application_choice)
return unless application_choice.application_form.teacher_degree_apprenticeship_feature_active?
return if application_choice.course.undergraduate?

if application_choice.application_form.no_degree_and_degree_completed?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
<div class="govuk-grid-column-two-thirds">
<% content_for :title, title_with_error_prefix(t('page_titles.degree_country'), @wizard.errors.any?) %>
<% if teacher_degree_apprenticeship_feature_active? %>
<% content_for :before_content, govuk_back_link_to(candidate_interface_degree_university_degree_path) %>
<% else %>
<% content_for :before_content, govuk_back_link_to(candidate_interface_degree_review_path) %>
<% end %>
<% content_for :before_content, govuk_back_link_to(candidate_interface_degree_university_degree_path) %>
<%= form_with model: @wizard, url: candidate_interface_degree_country_path do |f| %>
<%= f.govuk_error_summary %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/candidate_interface/degrees/review/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<%= render CandidateInterface::CompleteSectionComponent.new(
section_policy: @section_policy,
form: f,
hint_text: (teacher_degree_apprenticeship_feature_active? ? t('application_form.degree.review.teacher_degree_apprenticeship_feature_flag_on.complete_hint_text') : t('application_form.degree.review.complete_hint_text')).html_safe,
hint_text: t('application_form.degree.review.complete_hint_text_html'),
) %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<%= f.govuk_radio_button :qualification_type,
'no_other_qualifications',
label: { text: current_application.international_applicant? ? 'I do not want to add any other qualifications' : 'I do not want to add any A levels and other qualifications' },
hint: -> { teacher_degree_apprenticeship_feature_active? ? t('application_form.other_qualification.qualification_type.no_other_qualifications.tda_hint_text') : t('application_form.other_qualification.qualification_type.no_other_qualifications.hint_text') } %>
hint: -> { t('application_form.other_qualification.qualification_type.no_other_qualifications.tda_hint_text') } %>
<% end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ You could consider a different route into teaching.

[Find out how to train to teach if you do not have a degree](<%= t('get_into_teaching.url_train_without_a_degree') %>).

<% if FeatureFlag.active?(:teacher_degree_apprenticeship) %>
You may also be eligible to apply for a teacher degree apprenticeship (TDA). This new course will allow you work in a school and earn a salary while getting a bachelor’s degree and Qualified Teacher Status (QTS). So you will not have to pay tuition fees.
You may also be eligible to apply for a teacher degree apprenticeship (TDA). This new course will allow you work in a school and earn a salary while getting a bachelor’s degree and Qualified Teacher Status (QTS). So you will not have to pay tuition fees.

[Find out more about teacher degree apprenticeships (TDAs)](<%= t('get_into_teaching.url_teacher_degree_apprenticeship') %>).
<% end %>
[Find out more about teacher degree apprenticeships (TDAs)](<%= t('get_into_teaching.url_teacher_degree_apprenticeship') %>).
4 changes: 1 addition & 3 deletions config/locales/candidate_interface/degree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ en:
label: What year %{did_or_will} you graduate?
hint: For example, 2019
review:
complete_hint_text: Check the entry requirements for your chosen course. Providers usually ask for a degree at 2:2 or above. Contact the training provider if you do not have the right degree level.
teacher_degree_apprenticeship_feature_flag_on:
complete_hint_text: Check the entry requirements for your chosen course. Postgraduate courses usually require a bachelor’s degree at 2:2 or above. Contact the training provider if you do not have the right degree level. <p class=\"govuk-block\">Teacher degree apprenticeships do not require a degree.</p>
complete_hint_text_html: Check the entry requirements for your chosen course. Postgraduate courses usually require a bachelor’s degree at 2:2 or above. Contact the training provider if you do not have the right degree level. <p class=\"govuk-block\">Teacher degree apprenticeships do not require a degree.</p>
not_specified: Not entered
another:
button: Add another degree
Expand Down
31 changes: 4 additions & 27 deletions spec/components/candidate_interface/degree_empty_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,11 @@
end
end

describe 'when teacher degree apprenticeship feature is on' do
subject(:result) { render_inline(described_class.new(application_form:)).text }
it 'renders degree types headers' do
result = render_inline(described_class.new(application_form: build(:application_form)))

let(:application_form) { create(:application_form, recruitment_cycle_year: 2025) }

before do
FeatureFlag.activate(:teacher_degree_apprenticeship)
end

it 'renders degree types headers' do
expect(result).to include('Postgraduate teacher training courses')
expect(result).to include('Teacher degree apprenticeships')
end
end

describe 'when teacher degree apprenticeship feature is off' do
subject(:result) { render_inline(described_class.new(application_form:)).text }

let(:application_form) { create(:application_form, recruitment_cycle_year: 2024) }

before do
FeatureFlag.deactivate(:teacher_degree_apprenticeship)
end

it 'does not render degree types headers' do
expect(result).not_to include('Postgraduate teacher training courses')
expect(result).not_to include('Teacher degree apprenticeships')
end
expect(result.text).to include('Postgraduate teacher training courses')
expect(result.text).to include('Teacher degree apprenticeships')
end

describe 'button text' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,36 +258,10 @@
).text.gsub(/\r?\n/, ' ').squeeze(' ').strip
end

context 'when teacher degree apprenticeship feature is on' do
before { FeatureFlag.activate(:teacher_degree_apprenticeship) }

it 'shows postgraduate and undergraduate content' do
expect(result).to include(
'A levels are required for teacher degree apprenticeships. If you are applying to postgraduate courses, adding A levels and other qualifications will make your application stronger. They demonstrate subject knowledge not covered in your degree or work history.',
)
end
end

context 'when teacher degree apprenticeship feature is on but is an application prior to 2025' do
let(:application_form) { create(:application_form, recruitment_cycle_year: 2024) }

before { FeatureFlag.activate(:teacher_degree_apprenticeship) }

it 'shows postgraduate content' do
expect(result).to include(
'Adding A levels and other qualifications makes your application stronger. They demonstrate subject knowledge not covered in your degree or work experience. Training providers usually ask you for them later in the process. Add a qualification',
)
end
end

context 'when teacher degree apprenticeship feature is off' do
before { FeatureFlag.deactivate(:teacher_degree_apprenticeship) }

it 'shows postgraduate content' do
expect(result).to include(
'Adding A levels and other qualifications makes your application stronger. They demonstrate subject knowledge not covered in your degree or work experience. Training providers usually ask you for them later in the process. Add a qualification',
)
end
it 'shows postgraduate and undergraduate content' do
expect(result).to include(
'A levels are required for teacher degree apprenticeships. If you are applying to postgraduate courses, adding A levels and other qualifications will make your application stronger. They demonstrate subject knowledge not covered in your degree or work history.',
)
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/factories/application_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@
end

trait :with_bachelor_degree do
university_degree { true }
after(:create) do |application_form, _|
create(:degree_qualification, :bachelor, application_form:)
end
end

trait :with_degree do
university_degree { true }
after(:create) do |application_form, _|
create(:degree_qualification, application_form:)
end
Expand Down
40 changes: 0 additions & 40 deletions spec/models/application_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1220,44 +1220,4 @@ def application_form_with_course_option_for_provider_with(level:)
end
end
end

describe '#teacher_degree_apprenticeship_feature_active?' do
let(:application_form) { build(:application_form) }

context 'when the teacher degree apprenticeship feature flag is active and recruitment cycle year is 2025 or later' do
it 'returns true' do
FeatureFlag.activate(:teacher_degree_apprenticeship)
application_form.recruitment_cycle_year = 2025

expect(application_form.teacher_degree_apprenticeship_feature_active?).to be true
end
end

context 'when the teacher degree apprenticeship feature flag is active but recruitment cycle year is before 2025' do
it 'returns false' do
FeatureFlag.activate(:teacher_degree_apprenticeship)
application_form.recruitment_cycle_year = 2024

expect(application_form.teacher_degree_apprenticeship_feature_active?).to be false
end
end

context 'when the teacher degree apprenticeship feature flag is not active but recruitment cycle year is 2025 or later' do
it 'returns false' do
FeatureFlag.deactivate(:teacher_degree_apprenticeship)
application_form.recruitment_cycle_year = 2025

expect(application_form.teacher_degree_apprenticeship_feature_active?).to be false
end
end

context 'when the teacher degree apprenticeship feature flag is not active and recruitment cycle year is before 2025' do
it 'returns false' do
FeatureFlag.deactivate(:teacher_degree_apprenticeship)
application_form.recruitment_cycle_year = 2024

expect(application_form.teacher_degree_apprenticeship_feature_active?).to be false
end
end
end
end
Loading

0 comments on commit 54617ba

Please sign in to comment.