Skip to content

Commit

Permalink
Show application form statuses
Browse files Browse the repository at this point in the history
This switches the rendering of the application form statuses to use the
cached column.
  • Loading branch information
thomasleese committed Sep 24, 2023
1 parent 3ffa4d1 commit e066920
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
23 changes: 7 additions & 16 deletions app/helpers/application_form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ def application_form_summary_rows(
text: I18n.t("application_form.summary.status"),
},
value: {
text: application_form_status_tag(application_form, class_context:),
text:
render(
StatusTag::Component.new(
application_form.statuses,
class_context:,
),
),
},
},
].compact
Expand All @@ -161,19 +167,4 @@ def application_form_display_work_history_before_teaching_qualification_banner?(
earliest_certificate_date.present? && earliest_work_history_date.present? &&
earliest_work_history_date < earliest_certificate_date
end

private

def application_form_status_tag(application_form, class_context:)
statuses =
if %w[overdue received waiting_on].include?(application_form.status)
%w[further_information professional_standing qualification reference]
.map { |requestable| "#{application_form.status}_#{requestable}" }
.filter { |status| application_form.send(status) }
else
application_form.status
end

render(StatusTag::Component.new(statuses, class_context:))
end
end
2 changes: 1 addition & 1 deletion spec/helpers/application_form_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
},
value: {
text:
"<strong class=\"govuk-tag govuk-tag--grey\">Not started</strong>\n",
"<strong class=\"govuk-tag govuk-tag--grey\">Assessment not started</strong>\n",
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def given_there_is_an_application_form_with_professional_standing_request

def and_i_see_a_waiting_on_status
expect(assessor_application_page.status_summary.value).to have_text(
"WAITING ON PROFESSIONAL STANDING",
"WAITING ON LOPS",
)
end

Expand Down Expand Up @@ -71,6 +71,7 @@ def application_form
:application_form,
:waiting_on,
waiting_on_professional_standing: true,
statuses: %w[waiting_on_lops],
assessment: create(:assessment, :with_professional_standing_request),
teaching_authority_provides_written_statement: true,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def given_there_is_an_application_form_with_professional_standing_request

def and_i_see_a_waiting_on_status
expect(assessor_application_page.status_summary.value).to have_text(
"WAITING ON PROFESSIONAL STANDING",
"WAITING ON LOPS",
)
end

Expand Down Expand Up @@ -75,7 +75,7 @@ def when_i_fill_in_the_review_form

def and_i_see_a_received_status
expect(assessor_application_page.status_summary.value).to have_text(
"RECEIVED PROFESSIONAL STANDING",
"RECEIVED LOPS",
)
end

Expand All @@ -87,6 +87,7 @@ def application_form
:application_form,
:waiting_on,
waiting_on_professional_standing: true,
statuses: %w[waiting_on_lops],
)
create(
:assessment,
Expand Down

0 comments on commit e066920

Please sign in to comment.