Skip to content

Commit 52c7855

Browse files
authored
CDPT-1110 Changes to disable functionality (#703)
* empty * Remove permanent maintenance mode (#702) * CDPT-1112 Remove enhanced check details (#704) * CDPT-1114 Update DBS wording (#705) * CDPT-1111 Remove content and link to add more convictions (#706) * CDPT-1116 Update notification banner (#707) * Update military community order rehab periods (#708) * CDPT-1113 Disclaimers (#709) * Add back link (#710) * Add instructions * CDPT-1133 Fix multiple sentence bug (#711) * CDPT-1145 Add military reprimand (#712) * Disable backoffice in production (#714) * CDPT-1153 Remove bail tag pages (#713)
1 parent 515ddca commit 52c7855

File tree

62 files changed

+314
-600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+314
-600
lines changed

app/controllers/application_controller.rb

-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ class ApplicationController < ActionController::Base
22
include SecurityHandling
33
include ErrorHandling
44

5-
before_action :maintenance_mode
6-
75
# This is required to get request attributes in to the production logs.
86
# See the various lograge configurations in `production.rb`.
97
def append_info_to_payload(payload)
@@ -51,8 +49,4 @@ def initialize_disclosure_check(attributes = {})
5149
session[:disclosure_check_id] = disclosure_check.id
5250
end
5351
end
54-
55-
def maintenance_mode
56-
render "errors/maintenance" if Rails.env.production?
57-
end
5852
end

app/controllers/backoffice/reports_controller.rb

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module Backoffice
22
class ReportsController < ApplicationController
3+
before_action :check_environment
4+
35
RESULTS_LIMIT = 50
46

57
def index
@@ -23,5 +25,9 @@ def completed_reports
2325
def sort_by_sentences?
2426
params[:sentences].presence
2527
end
28+
29+
def check_environment
30+
redirect_to root_path if Rails.env.production?
31+
end
2632
end
2733
end

app/controllers/home_controller.rb

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
class HomeController < ApplicationController
2-
before_action :existing_disclosure_check_warning, :reset_disclosure_check_session
2+
before_action :existing_disclosure_check_warning
33

44
def index
5-
redirect_to steps_check_kind_path
5+
if params[:new] == "y"
6+
redirect_to steps_check_kind_path
7+
else
8+
@continue_link ||= edit_steps_check_kind_path # rubocop:disable Naming/MemoizedInstanceVariableName
9+
end
610
end
711

812
private
@@ -13,8 +17,10 @@ def in_progress_enough?
1317
end
1418

1519
def existing_disclosure_check_warning
16-
return unless in_progress_enough? && !params.key?(:new)
17-
18-
redirect_to warning_reset_session_path
20+
if in_progress_enough? && !params.key?(:new)
21+
@continue_link = warning_reset_session_path
22+
else
23+
reset_disclosure_check_session
24+
end
1925
end
2026
end

app/controllers/steps/conviction/conviction_bail_controller.rb

-16
This file was deleted.

app/controllers/steps/conviction/conviction_bail_days_controller.rb

-16
This file was deleted.

app/decorators/conviction_decorator.rb

-9
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,4 @@ def motoring_fine?
4040
ConvictionType::ADULT_MOTORING_FINE,
4141
].include?(self)
4242
end
43-
44-
def bailable_offense?
45-
[
46-
ConvictionType::DETENTION,
47-
ConvictionType::DETENTION_TRAINING_ORDER,
48-
ConvictionType::ADULT_PRISON_SENTENCE,
49-
ConvictionType::ADULT_SUSPENDED_PRISON_SENTENCE,
50-
].include?(self)
51-
end
5243
end

app/forms/steps/conviction/conviction_bail_days_form.rb

-20
This file was deleted.

app/forms/steps/conviction/conviction_bail_form.rb

-9
This file was deleted.

app/forms/steps/conviction/conviction_subtype_form.rb

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ def persist!
3535
conviction_subtype:,
3636
# The following are dependent attributes that need to be reset if form changes
3737
known_date: nil,
38-
conviction_bail: nil,
39-
conviction_bail_days: nil,
4038
conviction_length: nil,
4139
conviction_length_type: nil,
4240
compensation_paid: nil,

app/presenters/conviction_result_presenter.rb

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def question_attributes
1111
:conviction_date,
1212
:known_date,
1313
[:conviction_length, i18n_conviction_length],
14-
:conviction_bail_days,
1514
:compensation_payment_date,
1615
:motoring_endorsement,
1716
:schedule18_over_4_years,
@@ -22,7 +21,6 @@ def editable_attributes
2221
{
2322
known_date: ->(id) { edit_steps_conviction_known_date_path(check_id: id, next_step: :cya) },
2423
conviction_length: ->(id) { edit_steps_conviction_conviction_length_type_path(check_id: id) },
25-
conviction_bail_days: ->(id) { edit_steps_conviction_conviction_bail_days_path(check_id: id, next_step: :cya) },
2624
compensation_payment_date: ->(id) { edit_steps_conviction_compensation_payment_date_path(check_id: id, next_step: :cya) },
2725
motoring_endorsement: ->(id) { edit_steps_conviction_motoring_endorsement_path(check_id: id, next_step: :cya) },
2826
schedule18_over_4_years: ->(id) { edit_steps_conviction_conviction_schedule18_path(check_id: id) },

app/presenters/results_presenter.rb

-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ def motoring?
2222
conviction_checks.map(&:conviction).compact.any?(&:motoring?)
2323
end
2424

25-
def time_on_bail?
26-
conviction_checks.any? do |disclosure_check|
27-
disclosure_check.conviction_bail_days.to_i.positive?
28-
end
29-
end
30-
3125
def scope
3226
:results
3327
end

app/services/calculators/multiples/proceedings.rb

+11-7
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,11 @@ def initialize(check_group)
1010
end
1111

1212
def spent_date
13-
return ResultsVariant::NEVER_SPENT if expiry_dates.include?(ResultsVariant::NEVER_SPENT)
14-
return ResultsVariant::INDEFINITE if expiry_dates.include?(ResultsVariant::INDEFINITE)
15-
16-
# Pick the latest date in the collection
17-
# If there is only one sentence then it returns that date
18-
expiry_dates.max
13+
max_expiry(expiry_dates)
1914
end
2015

2116
def spent_date_without_relevant_orders
22-
non_relevant_expiry_dates.max
17+
max_expiry(non_relevant_expiry_dates)
2318
end
2419

2520
def spent?
@@ -44,6 +39,15 @@ def conviction?
4439

4540
private
4641

42+
def max_expiry(expiry_dates)
43+
return ResultsVariant::NEVER_SPENT if expiry_dates.include?(ResultsVariant::NEVER_SPENT)
44+
return ResultsVariant::INDEFINITE if expiry_dates.include?(ResultsVariant::INDEFINITE)
45+
46+
# Pick the latest date in the collection
47+
# If there is only one sentence then it returns that date
48+
expiry_dates.max
49+
end
50+
4751
def disclosure_checks
4852
@disclosure_checks ||= check_group.disclosure_checks.completed
4953
end

app/services/calculators/sentence_calculator.rb

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Calculators
22
class SentenceCalculator < BaseCalculator
33
UPPER_LIMIT_MONTHS = Float::INFINITY
4-
BAIL_OFFSET = -1.0
54

65
class Detention < SentenceCalculator
76
def rehabilitation_period
@@ -43,7 +42,7 @@ def expiry_date
4342
if disclosure_check.schedule18_over_4_years?
4443
ResultsVariant::NEVER_SPENT
4544
else
46-
conviction_end_date.advance(rehabilitation_period).advance(bail_offset)
45+
conviction_end_date.advance(rehabilitation_period)
4746
end
4847
end
4948

@@ -60,13 +59,5 @@ def valid?
6059
def conviction_end_date
6160
super.advance(days: -1)
6261
end
63-
64-
# Each full day spent on bail with a tag offsets the value of `BAIL_OFFSET`
65-
# from the sentence length (after the rehabilitation period has been applied).
66-
# Attribute can be blank or nil, but `#to_i` makes it safe.
67-
#
68-
def bail_offset
69-
{ days: disclosure_check.conviction_bail_days.to_i * BAIL_OFFSET }
70-
end
7162
end
7263
end

app/services/conviction_decision_tree.rb

+1-10
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ def destination
99
edit(:conviction_subtype)
1010
when :conviction_subtype
1111
after_conviction_subtype
12-
when :conviction_bail_days, :motoring_endorsement
12+
when :motoring_endorsement
1313
known_date_question
14-
when :conviction_bail
15-
after_conviction_bail
1614
when :known_date
1715
after_known_date
1816
when :conviction_length_type
@@ -58,7 +56,6 @@ def after_conviction_length
5856
end
5957

6058
def after_conviction_subtype
61-
return edit(:conviction_bail) if conviction.bailable_offense?
6259
return edit(:compensation_paid) if conviction.compensation?
6360
return edit(:motoring_endorsement) if conviction.motoring_fine?
6461

@@ -83,12 +80,6 @@ def after_compensation_paid
8380
show(:compensation_not_paid)
8481
end
8582

86-
def after_conviction_bail
87-
return edit(:conviction_bail_days) if step_value(:conviction_bail).inquiry.yes?
88-
89-
known_date_question
90-
end
91-
9283
def known_date_question
9384
edit(:known_date)
9485
end

app/value_objects/conviction_type.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ def initialize(raw_value, params = {})
6161
COMPENSATION_TO_A_VICTIM = new(:compensation_to_a_victim, parent: FINANCIAL, relevant_order: true, calculator_class: Calculators::CompensationCalculator),
6262

6363
DISMISSAL = new(:dismissal, parent: MILITARY, skip_length: true, calculator_class: Calculators::AdditionCalculator::StartPlusSixMonths),
64-
OVERSEAS_COMMUNITY_ORDER = new(:overseas_community_order, parent: MILITARY, calculator_class: Calculators::AdditionCalculator::PlusSixMonths),
65-
SERVICE_COMMUNITY_ORDER = new(:service_community_order, parent: MILITARY, calculator_class: Calculators::AdditionCalculator::PlusSixMonths),
64+
OVERSEAS_COMMUNITY_ORDER = new(:overseas_community_order, parent: MILITARY, relevant_order: true, no_drag_through: true, calculator_class: Calculators::AdditionCalculator::PlusZeroMonths),
65+
SERVICE_COMMUNITY_ORDER = new(:service_community_order, parent: MILITARY, relevant_order: true, no_drag_through: true, calculator_class: Calculators::AdditionCalculator::PlusZeroMonths),
6666
SERVICE_DETENTION = new(:service_detention, parent: MILITARY, calculator_class: Calculators::AdditionCalculator::PlusSixMonths),
67+
REPRIMAND = new(:reprimand, parent: MILITARY, skip_length: true, calculator_class: Calculators::AdditionCalculator::StartPlusSixMonths),
6768

6869
REPARATION_ORDER = new(:reparation_order, parent: PREVENTION_REPARATION, relevant_order: true, no_drag_through: true, skip_length: true, calculator_class: Calculators::ImmediatelyCalculator),
6970
RESTRAINING_ORDER = new(:restraining_order, parent: PREVENTION_REPARATION, relevant_order: true, no_drag_through: true, calculator_class: Calculators::AdditionCalculator::PlusZeroMonths),
@@ -95,9 +96,10 @@ def initialize(raw_value, params = {})
9596
ADULT_COMPENSATION_TO_A_VICTIM = new(:adult_compensation_to_a_victim, parent: ADULT_FINANCIAL, relevant_order: true, calculator_class: Calculators::CompensationCalculator),
9697

9798
ADULT_DISMISSAL = new(:adult_dismissal, parent: ADULT_MILITARY, skip_length: true, calculator_class: Calculators::AdditionCalculator::StartPlusTwelveMonths),
98-
ADULT_OVERSEAS_COMMUNITY_ORDER = new(:adult_overseas_community_order, parent: ADULT_MILITARY, calculator_class: Calculators::AdditionCalculator::PlusTwelveMonths),
99-
ADULT_SERVICE_COMMUNITY_ORDER = new(:adult_service_community_order, parent: ADULT_MILITARY, calculator_class: Calculators::AdditionCalculator::PlusTwelveMonths),
99+
ADULT_OVERSEAS_COMMUNITY_ORDER = new(:adult_overseas_community_order, parent: ADULT_MILITARY, relevant_order: true, no_drag_through: true, calculator_class: Calculators::AdditionCalculator::PlusZeroMonths),
100+
ADULT_SERVICE_COMMUNITY_ORDER = new(:adult_service_community_order, parent: ADULT_MILITARY, relevant_order: true, no_drag_through: true, calculator_class: Calculators::AdditionCalculator::PlusZeroMonths),
100101
ADULT_SERVICE_DETENTION = new(:adult_service_detention, parent: ADULT_MILITARY, calculator_class: Calculators::AdditionCalculator::PlusTwelveMonths),
102+
ADULT_REPRIMAND = new(:adult_reprimand, parent: ADULT_MILITARY, skip_length: true, calculator_class: Calculators::AdditionCalculator::StartPlusTwelveMonths),
101103

102104
ADULT_DISQUALIFICATION = new(:adult_disqualification, parent: ADULT_MOTORING, relevant_order: true, no_drag_through: true, calculator_class: Calculators::DisqualificationCalculator::Adults),
103105
ADULT_MOTORING_FINE = new(:adult_motoring_fine, parent: ADULT_MOTORING, skip_length: true, calculator_class: Calculators::Motoring::Adult::Fine),

app/views/home/index.en.html.erb

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
11
<% title '' %>
22

3+
<%= step_header(path: ExternalUrl.govuk_service_start_page) %>
4+
35
<div class="govuk-grid-row">
46
<div class="govuk-grid-column-two-thirds">
57
<h1 class="govuk-heading-xl">
6-
<%= service_name %>
8+
This tool is being updated
79
</h1>
810

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

1415
<div class="govuk-body">
15-
You won't be asked for any personally identifiable information such as your name or email address.
16+
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.
1617
</div>
1718

18-
<p class="govuk-body">
19-
You do not need to tell people about a spent caution or conviction if they ask for a basic criminal record check.
20-
You can read more
21-
<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>.
22-
</p>
19+
<div class="govuk-body">
20+
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.
21+
</div>
2322

24-
<p class="govuk-body">
25-
You cannot use this checker if you:
26-
</p>
23+
<div class="govuk-body">
24+
To find out how having more than one conviction can impact rehabilitation periods please see guidance on the
25+
<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>.
26+
</div>
2727

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

33-
<%= 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 %>
34-
Start now
32+
<%= link_to @continue_link, class: 'govuk-button govuk-button--start govuk-!-margin-top-2', data: { module: 'govuk-button' }, role: 'button', draggable: false do %>
33+
Continue
3534
<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">
3635
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
3736
</svg>

app/views/layouts/_notification_banner.html.erb

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
</div>
99
<div class="govuk-notification-banner__content">
1010
<p class="govuk-notification-banner__heading">
11-
<%= t '.content_paragraph_1' %>
12-
</p>
13-
<p class="govuk-notification-banner__heading">
14-
<%= t '.content_paragraph_2_html' %>
11+
<%= t '.content_paragraph_html' %>
1512
</p>
1613
</div>
1714
</div>

app/views/steps/check/check_your_answers/_add_more.html.erb

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p class="govuk-body-l">You can add more cautions or convictions now if you need to check more than one.</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<h2 class="govuk-heading-l govuk-!-margin-top-8">Next steps</h2>
2+
3+
<p class="govuk-body">
4+
Whilst we work on the updates the tool cannot be used for checking the combined rehabilitation period for more than one conviction.
5+
</p>
6+
7+
<p class="govuk-body">
8+
To find out how having more than one conviction can impact rehabilitation periods please see guidance on the
9+
<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>.
10+
</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<h2 class="govuk-heading-l govuk-!-margin-top-8">Next steps</h2>
2+
3+
<p class="govuk-body">
4+
You must enter all cautions and convictions to get accurate results.
5+
</p>
6+
7+
<%= button_to checks_path,
8+
class: 'govuk-button govuk-button--secondary',
9+
data: { module: 'govuk-button', 'prevent-double-click': true } do; 'Add a caution or conviction'; end %>

0 commit comments

Comments
 (0)