Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
elceebee committed Jan 8, 2025
1 parent 22b7fd6 commit 31c2ebe
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 64 deletions.
4 changes: 2 additions & 2 deletions app/frontend/styles/provider/_withdrawal_reasons_report.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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' }
Expand All @@ -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' }
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,28 @@
</h1>
<% if @withdrawal_reason_report.show_report? %>
<p class="govuk-body">
<%= t('provider_interface.withdrawal_reasons.show.report_description') %>
<%= t('.report_description') %>
</p>
<% else %>
<p class="govuk-body">
<%= t('provider_interface.withdrawal_reasons.show.report_not_visible') %>
</p>
<%= t('.report_not_visible_html', link: govuk_link_to(t('.withdrawal_report_link_text'), provider_interface_reports_provider_withdrawal_report_path(@provider))) %>
<% end %>
</div>

<% if @withdrawal_reason_report.show_report? %>
<div class="govuk-grid-column-full">
<div class="withdrawal-reasons-report-table__wrapper">
<%= govuk_table do |table| %>
<%= table.with_caption(text: t('provider_interface.withdrawal_reasons.show.table_caption'), html_attributes: { class: 'govuk-visually-hidden' }) %>
<%= table.with_caption(text: t('.table_caption'), html_attributes: { class: 'govuk-visually-hidden' }) %>
<%= table.with_head do |head| %>
<%= head.with_row do |row| %>
<% %w[withdrawal_reason before_accepting after_accepting total].each do |heading| %>
<%= row.with_cell(
text: t(".withdrawal_reason"),
html_attributes: { class: 'withdrawal-reasons-report-table__heading' },
) %>
<% %w[before_accepting after_accepting total].each do |heading| %>
<%= row.with_cell(
text: t("provider_interface.withdrawal_reasons.show.#{heading}"),
text: t(".#{heading}"),
numeric: true,
html_attributes: { class: 'withdrawal-reasons-report-table__heading' },
) %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l"><%= t('page_titles.provider.withdrawal_reports') %></h1>

<p class="govuk-body">
TBD, some text about why there are two different reports
</p>
<%= t('.description_html') %>

<% @providers.each do |provider| %>
<% if @providers.many? %>
Expand All @@ -17,14 +15,14 @@
<ul class="govuk-list govuk-list--spaced">
<li>
<%= govuk_link_to(
t('page_titles.provider.legacy_withdrawal_report'),
t('.legacy_withdrawal_report'),
provider_interface_reports_provider_withdrawal_report_path(provider),
no_visited_state: true,
) %>
</li>
<li>
<%= govuk_link_to(
t('page_titles.provider.withdrawal_reasons_report'),
t('.withdrawal_reasons_report'),
provider_interface_reports_provider_withdrawal_reasons_report_path(provider),
no_visited_state: true,
) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,22 @@
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">
<span class="govuk-caption-l"> <%= @provider.name %></span>
<%= t('page_titles.provider.withdrawal_report') %>
<%= t('.heading') %>
</h1>

<% if @submitted_withdrawal_reason_count < ProviderReports::MINIMUM_DATA_SIZE_REQUIRED %>
<p class="govuk-body">
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.
</p>
<p class="govuk-body">
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.
</p>
<% else %>
<p class="govuk-body">Candidates who withdraw their application are asked to select their reasons for withdrawing. This is an optional question.</p>
<p class="govuk-body">Candidates are asked this question when they withdraw:</p>
<ul class="govuk-list govuk-list--bullet">
<li>before a decision on their application is made</li>
<li>after accepting an offer</li>
</ul>
<p class="govuk-body">
Candidates who have received an offer are not able to withdraw – they have to either accept or decline instead.
</p>
<h2 class="govuk-heading-m">Applications withdrawn in the <%= RecruitmentCycle.cycle_name %> recruitment cycle</h2>
<p class="govuk-body">
Candidates can select multiple reasons, so the numbers in each column may not match the ‘Total’ number.
</p>
<p class="govuk-body">
This data has only been collected from 11 April 2023.
</p>
<%= t('.description_html', link: govuk_link_to(t('.withdrawal_reasons_report_link_text'), provider_interface_reports_provider_withdrawal_reasons_report_path(@provider))) %>
</div>
</div>

<% if @submitted_withdrawal_reason_count >= ProviderReports::MINIMUM_DATA_SIZE_REQUIRED %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">

<%= render ProviderInterface::ReportTableComponent.new(headers: ['Reason',
'Withdrawn before a decision',
'Withdrawn after accepting',
'Total'],
rows: @withdrawal_data,
show_footer: true,
bold_row_headers: false) %>

<% end %>
</div>
</div>
</div>
<% end %>
1 change: 0 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ en:
diversity_report: Sex, disability, ethnicity and age of candidates
withdrawal_report: Withdrawals
withdrawal_reports: Withdrawal reports
legacy_withdrawal_report: Old reasons for withdrawal report
withdrawal_reasons_report: Withdrawal reasons
start_apply_again: Do you want to apply again?
start_carry_over: Continue your application
Expand Down
29 changes: 29 additions & 0 deletions config/locales/provider_interface/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,32 @@ en:
info: 'The data will include all candidates who have accepted an offer since %{date}.'
previous_cycle:
info: 'The data will include all candidates who have accepted an offer from %{start_date} to %{end_date}.'
withdrawal_reports:
index:
description_html:
<p class="govuk-body">This report shows the reasons for withdrawal selected by candidates from a set list.</p>
<p class="govuk-body">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.</p>
<p class="govuk-body">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.</p>
legacy_withdrawal_report: 'Withdrawal reasons: up to January 2025'
withdrawal_reasons_report: 'Withdrawal reasons: from January 2025'
show:
heading: 'Withdrawal reasons: October'
description_html:
<p class="govuk-body">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.</p>
<p class="govuk-body">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.</p>
<p class="govuk-body">Data for this report was collected between 11 April 2023 and 13 January 2025.</p>
<p class="govuk-body">Go to the %{link} report to see more recent withdrawal data.</p>
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:
<p class="govuk-body">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.</p>
<p class="govuk-body">The report shows data from candidates who withdrew their application and selected their reason from a set list. This question is mandatory.</p>
<p class="govuk-body">Data for this report has been collected since 13 January 2025. Go to %{link} to see withdrawal data from before this date.</p>
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
11 changes: 0 additions & 11 deletions config/locales/provider_interface/withdrawal_reasons_report.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31c2ebe

Please sign in to comment.