Skip to content

Commit

Permalink
Merge pull request #1974 from DFE-Digital/declined_reasons_refactor
Browse files Browse the repository at this point in the history
Change to assessment_declined_reasons to seperate return of assessor …
  • Loading branch information
syed87 authored Feb 13, 2024
2 parents e0ef9c7 + 19c45fe commit 85c4895
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 36 deletions.
7 changes: 5 additions & 2 deletions app/components/timeline_entry/component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@

<ul class="govuk-list govuk-list--bullet">
<% reasons.each do |reason| %>
<li><%= simple_format reason %></li>
<% end %>
<li><%= simple_format reason[:name] %></li>
<% if reason[:assessor_note].present? %>
<li><%= simple_format reason[:assessor_note] %></li>
<% end %>
<% end %>
</ul>
<% end %>

Expand Down
41 changes: 25 additions & 16 deletions app/view_objects/teacher_interface/application_form_view_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,41 @@ def declined_reasons
if from_ineligible_country?
country_name = CountryName.from_country(country)
teaching_authority_name = region_teaching_authority_name(region)

{
"" => [
"As we are unable to verify professional standing documents with the #{teaching_authority_name} in " \
"#{country_name}, we have removed #{country_name} from the list of eligible countries.\n\nWe need to be " \
"able to verify all documents submitted by applicants with the relevant authorities. This is to ensure " \
"QTS requirements are applied fairly and consistently to every teacher, regardless of the country they " \
"trained to teach in.",
{
name:
"As we are unable to verify professional standing documents with the #{teaching_authority_name} in " \
"#{country_name}, we have removed #{country_name} from the list of eligible countries.\n\n" \
"We need to be able to verify all documents submitted by " \
"applicants with the relevant authorities. This is to ensure QTS requirements are applied " \
"fairly and consistently to every teacher, regardless of the country they trained to teach in.",
},
],
}
elsif further_information_request&.expired?
{
"" => [
I18n.t(
"teacher_interface.application_forms.show.declined.failure_reasons.further_information_request_expired",
),
{
name:
I18n.t(
"teacher_interface.application_forms.show.declined.failure_reasons.further_information_request_expired",
),
},
],
}
elsif professional_standing_request&.expired?
{
"" => [
I18n.t(
"teacher_interface.application_forms.show.declined.failure_reasons.professional_standing_request_expired",
certificate_name: region_certificate_name(region),
teaching_authority_name: region_teaching_authority_name(region),
),
{
name:
I18n.t(
"teacher_interface.application_forms.show.declined.failure_reasons." \
"professional_standing_request_expired",
certificate_name: region_certificate_name(region),
teaching_authority_name: region_teaching_authority_name(region),
),
},
],
}
else
Expand Down Expand Up @@ -253,9 +262,9 @@ def assessment_declined_reasons
assessor_feedback = failure_reason.assessor_feedback
).present? &&
FailureReasons.decline?(failure_reason: failure_reason.key)
"#{title}\n\n#{assessor_feedback}"
{ name: title, assessor_note: assessor_feedback }
else
title
{ name: title }
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,27 @@
<h4 class="govuk-heading-s"><%= title %></h4>
<% end %>

<% if reasons.count == 1 %>
<%= simple_format reasons.first %>
<% if reasons.size == 1 %>
<%= simple_format reasons.first[:name] %>
<% if reasons.first[:assessor_note].present? %>
<%= simple_format reasons.first[:assessor_note] %>
<% end %>
<% else %>
<ul class="govuk-list govuk-list--bullet">
<% reasons.each do |reason| %>
<li><%= simple_format reason %></li>
<li>
<%= simple_format reason[:name] %>
<% if reason[:assessor_note].present? %>
<%= simple_format reason[:assessor_note] %>
<% end %>
</li>
<% end %>
</ul>
<% end %>
<% end %>



<%= render "teacher_interface/application_forms/show/what_can_you_do_next", view_object: %>

<% unless view_object.from_ineligible_country? %>
Expand Down
6 changes: 5 additions & 1 deletion app/views/teacher_mailer/application_declined.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ Thank you for applying for QTS in England. Unfortunately, your application has b

<% end %>
<% reasons.each do |reason| %>
<%= reason %>
<%= reason[:name] %>

<% if reason[:assessor_note].present? %>
<%= reason[:assessor_note] %>

<% end %>
<% end %>
<% end %>
<% unless @view_object.declined_cannot_reapply? || @view_object.from_ineligible_country? %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,15 @@
is_expected.to eq(
{
"" => [
"As we are unable to verify professional standing documents with the teaching authority in Zimbabwe, " \
"we have removed Zimbabwe from the list of eligible countries.\n\nWe need to be able to verify all " \
"documents submitted by applicants with the relevant authorities. This is to ensure QTS requirements " \
"are applied fairly and consistently to every teacher, regardless of the country they trained to " \
"teach in.",
{
name:
"As we are unable to verify professional standing documents with the " \
"teaching authority in Zimbabwe, we have removed Zimbabwe from the " \
"list of eligible countries.\n\nWe need to be able to verify all " \
"documents submitted by applicants with the relevant authorities. " \
"This is to ensure QTS requirements are applied fairly and consistently " \
"to every teacher, regardless of the country they trained to teach in.",
},
],
},
)
Expand All @@ -233,8 +237,11 @@
is_expected.to eq(
{
"" => [
"Your application has been declined as you did not respond to the " \
"assessor’s request for further information within the specified time.",
{
name:
"Your application has been declined as you did not respond to the " \
"assessor’s request for further information within the specified time.",
},
],
},
)
Expand All @@ -247,9 +254,12 @@
is_expected.to eq(
{
"" => [
"Your application has been declined as we did not receive your letter " \
"that proves you’re recognised as a teacher from teaching authority " \
"within 180 days.",
{
name:
"Your application has been declined as we did not receive your letter " \
"that proves you’re recognised as a teacher from teaching authority " \
"within 180 days.",
},
],
},
)
Expand Down Expand Up @@ -288,10 +298,17 @@
is_expected.to eq(
{
"Personal information" => [
"The age range you are qualified to teach does not fall " \
"within the requirements of QTS.\n\nA note.",
"We were not provided with sufficient evidence to confirm " \
"qualification to teach at state or government schools.",
{
assessor_note: "A note.",
name:
"The age range you are qualified to teach does not fall " \
"within the requirements of QTS.",
},
{
name:
"We were not provided with sufficient evidence to confirm " \
"qualification to teach at state or government schools.",
},
],
},
)
Expand Down

0 comments on commit 85c4895

Please sign in to comment.