Skip to content

Commit

Permalink
Merge pull request #2939 from DFE-Digital/fe-poor-performance
Browse files Browse the repository at this point in the history
[LUPEYALPHA-555] Add poor performance form to FE journey
  • Loading branch information
asmega authored Jul 2, 2024
2 parents b3639c0 + 1c12a17 commit 9df263f
Show file tree
Hide file tree
Showing 25 changed files with 339 additions and 232 deletions.

This file was deleted.

39 changes: 39 additions & 0 deletions app/forms/poor_performance_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
class PoorPerformanceForm < Form
attribute :subject_to_formal_performance_action, :boolean
attribute :subject_to_disciplinary_action, :boolean

validates :subject_to_formal_performance_action,
inclusion: {
in: [true, false],
message: i18n_error_message("performance.inclusion")
}

validates :subject_to_disciplinary_action,
inclusion: {
in: [true, false],
message: i18n_error_message("disciplinary.inclusion")
}

def radio_options
[
OpenStruct.new(
id: true,
name: "Yes"
),
OpenStruct.new(
id: false,
name: "No"
)
]
end

def save
return false if invalid?

journey_session.answers.assign_attributes(
subject_to_formal_performance_action:,
subject_to_disciplinary_action:
)
journey_session.save
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ def employed_directly

def subject_to_formal_performance_action
[
t("additional_payments.forms.poor_performance.questions.formal_performance_action"),
t("additional_payments.forms.poor_performance.questions.performance.question"),
(journey_session.answers.subject_to_formal_performance_action? ? "Yes" : "No"),
"poor-performance"
]
end

def subject_to_disciplinary_action
[
t("additional_payments.forms.poor_performance.questions.disciplinary_action"),
t("additional_payments.forms.poor_performance.questions.disciplinary.question"),
(journey_session.answers.subject_to_disciplinary_action? ? "Yes" : "No"),
"poor-performance"
]
Expand Down
3 changes: 2 additions & 1 deletion app/models/journeys/further_education_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module FurtherEducationPayments
"teaching-hours-per-week" => TeachingHoursPerWeekForm,
"further-education-teaching-start-year" => FurtherEducationTeachingStartYearForm,
"subjects-taught" => SubjectsTaughtForm,
"teaching-qualification" => TeachingQualificationForm
"teaching-qualification" => TeachingQualificationForm,
"poor-performance" => PoorPerformanceForm
}
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class SessionAnswers < Journeys::SessionAnswers
attribute :further_education_teaching_start_year, :string
attribute :subjects_taught, default: []
attribute :teaching_qualification, :string
attribute :subject_to_formal_performance_action, :boolean
attribute :subject_to_disciplinary_action, :boolean

def school
@school ||= School.find(school_id)
Expand Down
102 changes: 22 additions & 80 deletions app/views/additional_payments/claims/poor_performance.html.erb
Original file line number Diff line number Diff line change
@@ -1,89 +1,31 @@
<% content_for(:page_title, page_title(t("#{@form.i18n_namespace}.forms.poor_performance.questions.poor_performance"), journey: current_journey_routing_name, show_error: @form.errors.any?)) %>
<% content_for(:page_title, page_title(@form.t(:heading), journey: current_journey_routing_name, show_error: @form.errors.any?)) %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render("shared/error_summary", instance: @form, errored_field_id_overrides: {
"subject_to_formal_performance_action": "claim_subject_to_formal_performance_action_true",
"subject_to_disciplinary_action": "claim_subject_to_disciplinary_action_true"
}) if @form.errors.any? %>
<%= form_for @form, url: claim_path(current_journey_routing_name) do |form| %>
<%= form_for @form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_error_summary %>

<h1 class="govuk-heading-l">
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.poor_performance") %>
<%= @form.t(:heading) %>
</h1>
<%= form_group_tag @form, :subject_to_formal_performance_action do %>

<%= form.hidden_field :subject_to_formal_performance_action %>

<fieldset class="govuk-fieldset" aria-describedby="formal_performance_action-hint">

<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
<h2 class="govuk-fieldset__heading">
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.formal_performance_action") %>
</h2>
</legend>

<%= errors_tag @form, :subject_to_formal_performance_action %>

<div id="formal_performance_action-hint" class="govuk-hint">
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.formal_performance_action_hint") %>
</div>

<div class="govuk-radios">

<div class="govuk-radios__item">
<%= form.radio_button(:subject_to_formal_performance_action, true, class: "govuk-radios__input") %>
<%= form.label :subject_to_formal_performance_action_true, "Yes", class: "govuk-label govuk-radios__label" %>
</div>

<div class="govuk-radios__item">
<%= form.radio_button(:subject_to_formal_performance_action, false, class: "govuk-radios__input") %>
<%= form.label :subject_to_formal_performance_action_false, "No", class: "govuk-label govuk-radios__label" %>
</div>

</div>

</fieldset>

<% end %>

<%= form_group_tag @form, :subject_to_disciplinary_action do %>

<%= form.hidden_field :subject_to_disciplinary_action %>

<fieldset class="govuk-fieldset" aria-describedby="disciplinary_action-hint">

<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
<h2 class="govuk-fieldset__heading">
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.disciplinary_action") %>
</h2>
</legend>

<%= errors_tag @form, :subject_to_disciplinary_action %>

<div id="disciplinary_action-hint" class="govuk-hint">
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.disciplinary_action_hint") %>
</div>

<div class="govuk-radios">

<div class="govuk-radios__item">
<%= form.radio_button(:subject_to_disciplinary_action, true, class: "govuk-radios__input") %>
<%= form.label :subject_to_disciplinary_action_true, "Yes", class: "govuk-label govuk-radios__label" %>
</div>

<div class="govuk-radios__item">
<%= form.radio_button(:subject_to_disciplinary_action, false, class: "govuk-radios__input") %>
<%= form.label :subject_to_disciplinary_action_false, "No", class: "govuk-label govuk-radios__label" %>
</div>

</div>

</fieldset>

<% end %>


<%= form.submit "Continue", class: "govuk-button", data: {module: "govuk-button"} %>
<%= f.govuk_collection_radio_buttons :subject_to_formal_performance_action, @form.radio_options, :id, :name,
legend: {
text: @form.t("questions.performance.question"),
tag: "h2",
size: "m"
},
hint: { text: @form.t("questions.performance.hint") } %>

<%= f.govuk_collection_radio_buttons :subject_to_disciplinary_action, @form.radio_options, :id, :name,
legend: {
text: @form.t("questions.disciplinary.question"),
tag: "h2",
size: "m"
},
hint: { text: @form.t("questions.disciplinary.hint") } %>

<%= f.govuk_submit %>
<% end %>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
<p class="govuk-body">
FE poor performance goes here
</p>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %>
<%= f.govuk_error_summary %>

<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %>
<%= f.govuk_submit %>
<% end %>
<h1 class="govuk-heading-l">
<%= @form.t(:heading) %>
</h1>

<%= f.govuk_collection_radio_buttons :subject_to_formal_performance_action, @form.radio_options, :id, :name,
legend: {
text: @form.t("questions.performance.question"),
tag: "h2",
size: "m"
},
hint: { text: @form.t("questions.performance.hint") } %>

<%= f.govuk_collection_radio_buttons :subject_to_disciplinary_action, @form.radio_options, :id, :name,
legend: {
text: @form.t("questions.disciplinary.question"),
tag: "h2",
size: "m"
},
hint: { text: @form.t("questions.disciplinary.hint") } %>

<%= f.govuk_submit %>
<% end %>
</div>
</div>
42 changes: 29 additions & 13 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -486,21 +486,23 @@ en:
errors:
blank: "Select yes if you have completed your induction"
poor_performance:
heading: Tell us if you are currently under any performance measures or disciplinary action
questions:
poor_performance: Tell us if you are currently under any performance measures or disciplinary action
disciplinary_action: "Are you currently subject to disciplinary action?"
disciplinary_action_hint:
"This is more serious than performance measures and could be because of misconduct. It is something we may
check with your school as it will affect your eligibility."
formal_performance_action: "Have any performance measures been started against you?"
formal_performance_action_hint:
"This will be as a result of your underperformance as a teacher over a period of time. It could put your
employment at the school at risk and is something we may check with your school as it will affect your
eligibility."
errors:
subject_to_formal_performance_action:
performance:
question: "Have any performance measures been started against you?"
hint:
"This will be as a result of your underperformance as a teacher over a period of time. It could put your
employment at the school at risk and is something we may check with your school as it will affect your
eligibility."
disciplinary:
question: "Are you currently subject to disciplinary action?"
hint:
"This is more serious than performance measures and could be because of misconduct. It is something we may
check with your school as it will affect your eligibility."
errors:
performance:
inclusion: Select yes if you are subject to formal action for poor performance at work
subject_to_disciplinary_action:
disciplinary:
inclusion: Select yes if you are subject to disciplinary action
qualification:
questions:
Expand Down Expand Up @@ -818,6 +820,20 @@ en:
hint: Your response will be noted for future claims. If you don’t have a teaching qualification yet, make sure that you enrol on one or complete one in the next 12 months.
errors:
inclusion: Select whether you have, are currently enrolled or plan to enrol on a teaching qualification
poor_performance:
heading: Tell us if you are currently under any performance measures or disciplinary action
questions:
performance:
question: Have any performance measures been started against you?
hint: This will be as a result of your underperformance as a teacher over a period of time. It could put your employment at the further education (FE) provider at risk and is something we may check with them as it will affect your eligibility.
disciplinary:
question: Are you currently subject to disciplinary action?
hint: This is more serious than performance measures and could be because of misconduct. It is something we may check with your FE provider as it will affect your eligibility.
errors:
performance:
inclusion: Select yes if you are subject to formal action for poor performance at work
disciplinary:
inclusion: Select yes if you are subject to disciplinary action
activerecord:
errors:
models:
Expand Down
8 changes: 6 additions & 2 deletions spec/features/backlink_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
click_on "Continue"

expect(page).to have_content("Tell us if you are currently under any performance measures or disciplinary action")
choose "claim_subject_to_formal_performance_action_false"
choose "claim_subject_to_disciplinary_action_false"
within all(".govuk-fieldset")[0] do
choose("No")
end
within all(".govuk-fieldset")[1] do
choose("No")
end
click_on "Continue"

expect(page).to have_content("Which route into teaching did you take?")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@
click_on "Continue"

# - Poor performance
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action"))
choose "claim_subject_to_formal_performance_action_false"
choose "claim_subject_to_disciplinary_action_false"
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question"))
within all(".govuk-fieldset")[0] do
choose("No")
end
within all(".govuk-fieldset")[1] do
choose("No")
end
click_on "Continue"

# - What route into teaching did you take?
Expand Down
24 changes: 16 additions & 8 deletions spec/features/combined_teacher_claim_journey_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@
click_on "Continue"

# - Poor performance
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question"))

choose "claim_subject_to_formal_performance_action_false"
choose "claim_subject_to_disciplinary_action_false"
within all(".govuk-fieldset")[0] do
choose("No")
end
within all(".govuk-fieldset")[1] do
choose("No")
end
click_on "Continue"

# - What route into teaching did you take?
Expand Down Expand Up @@ -278,11 +282,15 @@
click_on "Continue"

# - Poor performance
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question"))

choose "claim_subject_to_formal_performance_action_false"
choose "claim_subject_to_disciplinary_action_false"
within all(".govuk-fieldset")[0] do
choose("No")
end
within all(".govuk-fieldset")[1] do
choose("No")
end
click_on "Continue"

# - What route into teaching did you take?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,15 @@ def navigate_to_check_email_page(school:)
click_on "Continue"

# - Poor performance
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action"))

choose "claim_subject_to_formal_performance_action_false"
choose "claim_subject_to_disciplinary_action_false"
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question"))
expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question"))

within all(".govuk-fieldset")[0] do
choose("No")
end
within all(".govuk-fieldset")[1] do
choose("No")
end
click_on "Continue"

# - What route into teaching did you take?
Expand Down
Loading

0 comments on commit 9df263f

Please sign in to comment.