From 31c2ebe8fe82425d413a0d77e658974817d3e564 Mon Sep 17 00:00:00 2001 From: Lori Bailey <44073106+elceebee@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:42:04 +0000 Subject: [PATCH] WIP --- .../provider/_withdrawal_reasons_report.scss | 4 +-- ...ate_withdrawal_reasons_data_by_provider.rb | 19 ++++++---- .../withdrawal_reasons_reports/show.html.erb | 17 +++++---- .../reports/withdrawal_reports/index.html.erb | 8 ++--- .../reports/withdrawal_reports/show.html.erb | 36 ++++--------------- config/locales/en.yml | 1 - config/locales/provider_interface/reports.yml | 29 +++++++++++++++ .../withdrawal_reasons_report.yml | 11 ------ .../index_provider_user_two_providers_spec.rb | 2 +- 9 files changed, 63 insertions(+), 64 deletions(-) delete mode 100644 config/locales/provider_interface/withdrawal_reasons_report.yml diff --git a/app/frontend/styles/provider/_withdrawal_reasons_report.scss b/app/frontend/styles/provider/_withdrawal_reasons_report.scss index 937f8c3bf19..819d3179eeb 100644 --- a/app/frontend/styles/provider/_withdrawal_reasons_report.scss +++ b/app/frontend/styles/provider/_withdrawal_reasons_report.scss @@ -25,10 +25,10 @@ &__cell--second-level-with-nested-reasons { padding-left: govuk-spacing(3); - background: govuk-colour("light-grey"); + background: govuk-tint(govuk-colour('light-grey'), 50); } &__cell--light-grey-background { - background: govuk-colour("light-grey"); + background: govuk-tint(govuk-colour('light-grey'), 50); } } diff --git a/app/services/provider_interface/candidate_withdrawal_reasons_data_by_provider.rb b/app/services/provider_interface/candidate_withdrawal_reasons_data_by_provider.rb index 42a9cafd671..86219919564 100644 --- a/app/services/provider_interface/candidate_withdrawal_reasons_data_by_provider.rb +++ b/app/services/provider_interface/candidate_withdrawal_reasons_data_by_provider.rb @@ -11,7 +11,7 @@ def show_report? end def all_rows - return [] if withdrawal_reasons.count < 10 + return [] if application_form_count < ProviderReports::MINIMUM_DATA_SIZE_REQUIRED rows = [] nested_reasons.each_key do |level_one_reason| @@ -40,26 +40,27 @@ def build_reason_row(reason, level) ReasonRow.new( reason: { text: translate(reason), - html_attributes: reason_attributes_for(level), + html_attributes: text_cell_attributes_for(level), }, before_accepting: { text: before_accepting_count(reason), - html_attributes: numeric_attributes_for(level), numeric: true, + html_attributes: numeric_cell_attributes_for(level), }, after_accepting: { text: after_accepting_count(reason), - html_attributes: numeric_attributes_for(level), numeric: true, + html_attributes: numeric_cell_attributes_for(level), }, total: { text: before_accepting_count(reason) + after_accepting_count(reason), - html_attributes: numeric_attributes_for(level), numeric: true + numeric: true, + html_attributes: numeric_cell_attributes_for(level), }, ) end - def reason_attributes_for(level) + def text_cell_attributes_for(level) case level when 'level_one' { class: 'withdrawal-reasons-report-table__cell--main-reason' } @@ -74,7 +75,7 @@ def reason_attributes_for(level) end end - def numeric_attributes_for(level) + def numeric_cell_attributes_for(level) case level when 'level_one' { class: 'withdrawal-reasons-report-table__cell--main-reason' } @@ -126,5 +127,9 @@ def withdrawal_reasons .where('application_choices.provider_ids @> ARRAY[?]::bigint[]', @provider.id) .where(application_choices: { current_recruitment_cycle_year: RecruitmentCycle.current_year }) end + + def application_form_count + withdrawal_reasons.select('application_choices.application_form_id').distinct.count + end end end diff --git a/app/views/provider_interface/reports/withdrawal_reasons_reports/show.html.erb b/app/views/provider_interface/reports/withdrawal_reasons_reports/show.html.erb index e3958356839..91cbec5f0f3 100644 --- a/app/views/provider_interface/reports/withdrawal_reasons_reports/show.html.erb +++ b/app/views/provider_interface/reports/withdrawal_reasons_reports/show.html.erb @@ -10,12 +10,10 @@ <% if @withdrawal_reason_report.show_report? %>
- <%= t('provider_interface.withdrawal_reasons.show.report_description') %> + <%= t('.report_description') %>
<% else %> -- <%= t('provider_interface.withdrawal_reasons.show.report_not_visible') %> -
+ <%= t('.report_not_visible_html', link: govuk_link_to(t('.withdrawal_report_link_text'), provider_interface_reports_provider_withdrawal_report_path(@provider))) %> <% end %> @@ -23,12 +21,17 @@- TBD, some text about why there are two different reports -
+ <%= t('.description_html') %> <% @providers.each do |provider| %> <% if @providers.many? %> @@ -17,14 +15,14 @@- You will be able to see this report once it contains data from at least <%= ProviderReports::MINIMUM_DATA_SIZE_REQUIRED %> candidates. This is to protect the privacy of candidates. -
-- The report shows data from candidates who withdrew their application and selected their reason from a set list. This is an optional question. Data for this report has only been collected from 11 April 2023. -
- <% else %> -Candidates who withdraw their application are asked to select their reasons for withdrawing. This is an optional question.
-Candidates are asked this question when they withdraw:
-- Candidates who have received an offer are not able to withdraw – they have to either accept or decline instead. -
-- Candidates can select multiple reasons, so the numbers in each column may not match the ‘Total’ number. -
-- This data has only been collected from 11 April 2023. -
+ <%= t('.description_html', link: govuk_link_to(t('.withdrawal_reasons_report_link_text'), provider_interface_reports_provider_withdrawal_reasons_report_path(@provider))) %>This report shows the reasons for withdrawal selected by candidates from a set list.
+In January 2025 we made it mandatory for candidates to provide at least one reason for withdrawing. We also added some new reasons for candidates to select from.
+Because the new reasons do not map exactly to the old reasons, it is not possible to combine withdrawal data from before January 2025 with withdrawal data from after that date in a single report.
+ legacy_withdrawal_report: 'Withdrawal reasons: up to January 2025' + withdrawal_reasons_report: 'Withdrawal reasons: from January 2025' + show: + heading: 'Withdrawal reasons: October' + description_html: +You will be able to see this report if it contains data from at least 10 candidates. This is to protect the privacy of candidates.
+The report shows data from candidates who withdrew their application and selected their reason from a set list. This was an optional question, candidates who withdrew their application but did not select a reason are not represented in this report.
+Data for this report was collected between 11 April 2023 and 13 January 2025.
+Go to the %{link} report to see more recent withdrawal data.
+ withdrawal_reasons_report_link_text: 'withdrawal reasons: from January 2025' + withdrawal_reasons_reports: + show: + report_description: This report shows the reasons for withdrawal selected by candidates from a set list. The question is mandatory and candidates can select more than one reason. + report_not_visible_html: +You will be able to see this report when it contains data from at least 10 candidates. This is to protect the privacy of candidates. Candidates can select more than one reason for withdrawing so the number of reasons in this report may not match the number of candidates who have withdrawn.
+The report shows data from candidates who withdrew their application and selected their reason from a set list. This question is mandatory.
+Data for this report has been collected since 13 January 2025. Go to %{link} to see withdrawal data from before this date.
+ withdrawal_report_link_text: 'withdrawal reasons: up to January 2025' + table_caption: Withdrawal reason report data + withdrawal_reason: Withdrawal reason + before_accepting: Before accepting + after_accepting: After accepting + total: Total diff --git a/config/locales/provider_interface/withdrawal_reasons_report.yml b/config/locales/provider_interface/withdrawal_reasons_report.yml deleted file mode 100644 index 768217780f1..00000000000 --- a/config/locales/provider_interface/withdrawal_reasons_report.yml +++ /dev/null @@ -1,11 +0,0 @@ -en: - provider_interface: - withdrawal_reasons: - show: - report_description: TBD placeholder text for when the report is visible - report_not_visible: TBD placeholder text for when the report is not visible - table_caption: Withdrawal reason report data - withdrawal_reason: Withdrawal reason - before_accepting: Before accepting - after_accepting: After accepting - total: Total diff --git a/spec/system/provider_interface/reports/index_provider_user_two_providers_spec.rb b/spec/system/provider_interface/reports/index_provider_user_two_providers_spec.rb index a9bf5795bc0..37a9fa04830 100644 --- a/spec/system/provider_interface/reports/index_provider_user_two_providers_spec.rb +++ b/spec/system/provider_interface/reports/index_provider_user_two_providers_spec.rb @@ -6,7 +6,7 @@ before do FeatureFlag.deactivate(:new_candidate_withdrawal_reasons) end - + scenario 'when a provider user has more than one provider' do given_a_provider_user_with_two_providers_exists and_i_am_signed_in_as_provider_user