Skip to content

Commit

Permalink
Re-add multiple convictions (#741)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Preddy <6988369+njpreddy@users.noreply.github.com>
Co-authored-by: MeenaModhvadia <92523605+MeenaModhvadia@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 5, 2025
1 parent 381f04b commit c9b49fa
Show file tree
Hide file tree
Showing 39 changed files with 277 additions and 470 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ rerun.txt
.idea/misc.xml
.idea/vcs.xml
.idea/workspace.xml
/.idea
16 changes: 5 additions & 11 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
class HomeController < ApplicationController
before_action :existing_disclosure_check_warning
before_action :existing_disclosure_check_warning, :reset_disclosure_check_session

def index
if params[:new] == "y"
redirect_to steps_check_kind_path
else
@continue_link ||= edit_steps_check_kind_path # rubocop:disable Naming/MemoizedInstanceVariableName
end
redirect_to steps_check_kind_path
end

private
Expand All @@ -17,10 +13,8 @@ def in_progress_enough?
end

def existing_disclosure_check_warning
if in_progress_enough? && !params.key?(:new)
@continue_link = warning_reset_session_path
else
reset_disclosure_check_session
end
return unless in_progress_enough? && !params.key?(:new)

redirect_to warning_reset_session_path
end
end
3 changes: 1 addition & 2 deletions app/services/calculators/addition_calculator.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module Calculators
class AdditionCalculator < BaseCalculator
ADDED_TIME_IF_NO_LENGTH = { months: 24 }.freeze

#
# If length is given: conviction end date
# If no length is given: conviction start date + 24 months
#
class PlusZeroMonths < AdditionCalculator
def added_time
{}
Expand Down
57 changes: 0 additions & 57 deletions app/services/calculators/disqualification_calculator.rb

This file was deleted.

4 changes: 2 additions & 2 deletions app/services/calculators/motoring/adult/penalty_points.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module Motoring
module Adult
#
# We always assume an endorsement was received
# start_date + 5 years
# start_date + 3 years
#
class PenaltyPoints < BaseCalculator
REHABILITATION = { months: 60 }.freeze
REHABILITATION = { months: 36 }.freeze

def expiry_date
conviction_start_date.advance(REHABILITATION)
Expand Down
7 changes: 0 additions & 7 deletions app/services/calculators/sentence_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,5 @@ def expiry_date
def valid?
conviction_length_in_months <= self.class::UPPER_LIMIT_MONTHS
end

private

# The day before the end date, thus we subtract 1 day.
def conviction_end_date
super.advance(days: -1)
end
end
end
122 changes: 62 additions & 60 deletions app/value_objects/conviction_type.rb

Large diffs are not rendered by default.

39 changes: 20 additions & 19 deletions app/views/home/index.en.html.erb
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
<% title '' %>

<%= step_header(path: ExternalUrl.govuk_service_start_page) %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">
This tool is being updated
<%= service_name %>
</h1>

<div class="govuk-body">
Whilst we work on the updates the tool cannot be used for checking the combined rehabilitation period for more than one conviction.
</div>
<p class="govuk-body-l">
Answer some questions about your caution or conviction to find out whether you need to tell people about it.
You'll need to know the type of caution or conviction you got, and when.
</p>

<div class="govuk-body">
You will, however, be able to check the rehabilitation period for a conviction that has multiple sentences, for example, a prison sentence + an order + a fine.
You won't be asked for any personally identifiable information such as your name or email address.
</div>

<div class="govuk-body">
If you receive another conviction during a rehabilitation period, both your original and subsequent offences may remain unspent for the duration of whichever rehabilitation period is longer.
</div>
<p class="govuk-body">
You do not need to tell people about a spent caution or conviction if they ask for a basic criminal record check.
You can read more
<a class="govuk-link" href="https://www.gov.uk/guidance/telling-people-about-your-criminal-record#introduction" rel="external">about when cautions and convictions are spent</a>.
</p>

<div class="govuk-body">
To find out how having more than one conviction can impact rehabilitation periods please see guidance on the
<a class="govuk-link" href="https://www.gov.uk/government/publications/new-guidance-on-the-rehabilitation-of-offenders-act-1974/guidance-on-the-rehabilitation-of-offenders-act-1974-and-the-exceptions-order-1975#what-happens-if-someone-receives-another-caution-or-conviction-before-their-first-conviction-becomes-spent" rel="external">Rehabilitation of Offenders Act 1974</a>.
</div>
<p class="govuk-body">
You cannot use this checker if you:
</p>

<div class="govuk-body">
Click continue to check your caution or conviction.
</div>
<ul class="govuk-list govuk-list--bullet">
<li>were given more than one caution or sentence as part of a conviction</li>
<li>want to check a caution or conviction given outside England and Wales</li>
</ul>

<%= link_to @continue_link, class: 'govuk-button govuk-button--start govuk-!-margin-top-2', data: { module: 'govuk-button' }, role: 'button', draggable: false do %>
Continue
<%= link_to edit_steps_check_kind_path, class: 'govuk-button govuk-button--start govuk-!-margin-top-2', data: { module: 'govuk-button' }, role: 'button', draggable: false do %>
Start now
<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
</svg>
Expand Down
Empty file.

This file was deleted.

10 changes: 0 additions & 10 deletions app/views/steps/check/check_your_answers/_next_steps.html.erb

This file was deleted.

This file was deleted.

12 changes: 10 additions & 2 deletions app/views/steps/check/check_your_answers/show.en.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">Check your answers</h1>

<%= render "add_more" %>
<p class="govuk-body-l">You can add more cautions or convictions now if you need to check more than one.</p>

<%= render @presenter.summary %>

<%= render "next_steps" %>
<h2 class="govuk-heading-l govuk-!-margin-top-8">Next steps</h2>

<p class="govuk-body">
You must enter all cautions and convictions to get accurate results.
</p>

<%= button_to checks_path,
class: 'govuk-button govuk-button--secondary',
data: { module: 'govuk-button', 'prevent-double-click': true } do; 'Add a caution or conviction'; end %>

<p class="govuk-body">
If you have finished adding cautions and convictions, get your results.
Expand Down
4 changes: 2 additions & 2 deletions app/views/steps/check/kind/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% title t('.page_title') %>
<%
back_path = any_completed_checks? ? steps_check_check_your_answers_path : root_path
back_path = any_completed_checks? ? steps_check_check_your_answers_path : ExternalUrl.govuk_service_start_page
step_header(path: back_path)
%>

Expand All @@ -14,7 +14,7 @@

<%= step_form @form_object do |f| %>
<%= f.govuk_collection_radio_buttons :kind, CheckKind.values, :value, nil do %>
<p class="govuk-body-l"><%#=t '.lead_text' %></p>
<p class="govuk-body-l"><%=t '.lead_text' %></p>
<% end %>

<%= f.continue_button %>
Expand Down
10 changes: 0 additions & 10 deletions app/views/steps/check/results/show.en.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@
Read more about what information you need to give</a>.
</p>

<div class="govuk-inset-text govuk-!-padding-top-1 govuk-!-padding-bottom-1">
<p class="govuk-body">
Whilst we work on the updates the tool cannot be used for checking the combined rehabilitation period for more than one conviction.
</p>

<p class="govuk-body">
To find out how having more than one conviction can impact rehabilitation periods please see guidance on the <a class="govuk-link" rel="external" target="_blank" href="https://www.gov.uk/government/publications/new-guidance-on-the-rehabilitation-of-offenders-act-1974/guidance-on-the-rehabilitation-of-offenders-act-1974-and-the-exceptions-order-1975#what-happens-if-someone-receives-another-caution-or-conviction-before-their-first-conviction-becomes-spent">Rehabilitation of Offenders Act 1974</a>.
</p>
</div>

<% if @presenter.motoring? %>
<h3 class="govuk-heading-m">Your driving record</h3>

Expand Down
4 changes: 4 additions & 0 deletions config/locales/en/helpers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ en:
fine: Fine
compensation_to_a_victim: Compensation to a victim
# military
cashiering_discharge_dismissal: Cashiering, discharge with ignominy or dismissal with disgrace
dismissal: Dismissal
service_detention: Service detention
service_community_order: Service community order
Expand All @@ -83,6 +84,7 @@ en:
adult_fine: Fine
adult_compensation_to_a_victim: Compensation to a victim
# adult_military
adult_cashiering_discharge_dismissal: Cashiering, discharge with ignominy or dismissal with disgrace
adult_dismissal: Dismissal
adult_overseas_community_order: Overseas community order
adult_service_community_order: Service community order
Expand Down Expand Up @@ -319,6 +321,7 @@ en:
# default key
default: When were you given the order?
# alternative keys defined with `i18_attribute`
cashiering_discharge_dismissal: When were you given the cashiering, discharge or dismissal?
referral_order: What was the date of your first panel meeting?
dismissal: When were you given the dismissal?
reprimand: When were you given the severe reprimand or reprimand?
Expand All @@ -328,6 +331,7 @@ en:
absolute_discharge: When were you given the discharge?
conditional_discharge: When were you given the discharge?
adult_absolute_discharge: When were you given the discharge?
adult_cashiering_discharge_dismissal: When were you given the cashiering, discharge or dismissal?
adult_conditional_discharge: When were you given the discharge?
adult_suspended_prison_sentence: When did the sentence start?
adult_prison_sentence: When did the sentence start?
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en/results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ en:
fine: Fine
compensation_to_a_victim: Compensation to a victim
# military
cashiering_discharge_dismissal: Cashiering, discharge with ignominy or dismissal with disgrace
dismissal: Dismissal
service_detention: Service detention
service_community_order: Service community order
Expand All @@ -48,6 +49,7 @@ en:
adult_fine: Fine
adult_compensation_to_a_victim: Compensation to a victim
# adult_military
adult_cashiering_discharge_dismissal: Cashiering, discharge with ignominy or dismissal with disgrace
adult_dismissal: Dismissal
adult_overseas_community_order: Overseas community order
adult_service_community_order: Service community order
Expand Down
8 changes: 4 additions & 4 deletions features/02_cookies_consent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ Feature: Cookies consent functionality

Scenario: The banner shows and user accepts it
When I click the "Accept analytics cookies" button
Then I should be on "/"
Then I should be on "/steps/check/kind"
And I should see "You’ve accepted analytics cookies."
And I should see a "change your cookie settings" link to "/cookies"
When I click the "Hide this message" link
Then I should be on "/"
Then I should be on "/steps/check/kind"
And I should not see "You’ve accepted analytics cookies"
And I should not see "Cookies on Check when to disclose cautions or convictions"

Scenario: The banner shows and user rejects it
When I click the "Reject analytics cookies" button
Then I should be on "/"
Then I should be on "/steps/check/kind"
And I should see "You’ve rejected analytics cookies."
And I should see a "change your cookie settings" link to "/cookies"
When I click the "Hide this message" link
Then I should be on "/"
Then I should be on "/steps/check/kind"
And I should not see "You’ve rejected analytics cookies"
And I should not see "Cookies on Check when to disclose cautions or convictions"

Expand Down
13 changes: 6 additions & 7 deletions features/adults/caution.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: Caution
Background:
When I have started a check
When I visit "/"
Then I should see "Were you cautioned or convicted?"
When I choose "Cautioned"
Then I should see "How old were you when you got cautioned?"
Expand All @@ -14,10 +14,10 @@ Feature: Caution
Then I should see "When did you get the caution?"
When I enter a valid date

And I check my "caution" answers and go to the results page
And I check my "caution" answers and go to the results page
Then I should see "This caution is spent on the day you receive it"

And I should see "This caution will not appear on a basic DBS check."
And I should see "This caution will not appear on a basic DBS check."

@happy_path
Scenario: Over 18, conditional caution
Expand All @@ -29,9 +29,8 @@ Feature: Caution
Then I should see "When did the conditions end?"
When I enter a valid date

And I check my "caution" answers and go to the results page
And I check my "caution" answers and go to the results page
Then I should see "This caution was spent on 1 January 1999"

And I should see "This caution will not appear on a basic DBS check."

And I should not see "Your results say your caution or conviction may appear on a DBS check."
And I should see "This caution will not appear on a basic DBS check."
And I should not see "Your results say your caution or conviction may appear on a DBS check."
4 changes: 2 additions & 2 deletions features/adults/conviction_custodial_sentence.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Feature: Conviction

Examples:
| subtype | known_date_header | length_type_header | length_header | result |
| Prison sentence | When did the sentence start? | Was the length of the sentence given in days, weeks, months or years? | What was the length of the sentence? | This conviction will be spent on 31 October 2025 |
| Suspended prison sentence | When did the sentence start? | Was the length of the sentence given in days, weeks, months or years? | What was the length of the sentence? | This conviction will be spent on 31 October 2025 |
| Prison sentence | When did the sentence start? | Was the length of the sentence given in days, weeks, months or years? | What was the length of the sentence? | This conviction will be spent on 1 November 2025 |
| Suspended prison sentence | When did the sentence start? | Was the length of the sentence given in days, weeks, months or years? | What was the length of the sentence? | This conviction will be spent on 1 November 2025 |


@happy_path
Expand Down
Loading

0 comments on commit c9b49fa

Please sign in to comment.