Skip to content

Commit 2fd5019

Browse files
Merge pull request #4657 from alphagov/refactor-sick-pay
Remove deprecated methods from sick pay flow
2 parents abd8797 + 950f4c5 commit 2fd5019

9 files changed

+15
-58
lines changed

lib/smart_answer_flows/calculate-statutory-sick-pay.rb

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,6 @@ def define
228228
option :eight_weeks_less
229229
option :before_payday
230230

231-
precalculate :sick_start_date_for_awe do
232-
calculator.sick_start_date_for_awe
233-
end
234-
235231
on_response do |response|
236232
calculator.eight_weeks_earnings = response
237233
end
@@ -274,10 +270,6 @@ def define
274270
to { Calculators::StatutorySickPayCalculator.year_of_sickness }
275271
validate_in_range
276272

277-
precalculate :sick_start_date_for_awe do
278-
calculator.sick_start_date_for_awe
279-
end
280-
281273
on_response do |response|
282274
calculator.relevant_period_to = response
283275
end
@@ -297,10 +289,6 @@ def define
297289
to { Calculators::StatutorySickPayCalculator.year_of_sickness }
298290
validate_in_range
299291

300-
precalculate :pay_day_offset do
301-
calculator.pay_day_offset
302-
end
303-
304292
on_response do |response|
305293
calculator.relevant_period_from = response + 1.day
306294
end
@@ -316,14 +304,6 @@ def define
316304

317305
# Question 9.2
318306
money_question :total_employee_earnings? do
319-
precalculate :relevant_period_from do
320-
calculator.relevant_period_from
321-
end
322-
323-
precalculate :relevant_period_to do
324-
calculator.relevant_period_to
325-
end
326-
327307
on_response do |response|
328308
calculator.total_employee_earnings = response
329309
end
@@ -335,10 +315,6 @@ def define
335315

336316
# Question 10
337317
money_question :pay_amount_if_not_sick? do
338-
precalculate :sick_start_date_for_awe do
339-
calculator.sick_start_date_for_awe
340-
end
341-
342318
on_response do |response|
343319
calculator.relevant_contractual_pay = response
344320
end
@@ -418,32 +394,13 @@ def define
418394
outcome :not_regular_schedule
419395

420396
# Answer 5
421-
outcome :not_earned_enough do
422-
precalculate :lower_earning_limit do
423-
calculator.lower_earning_limit
424-
end
425-
426-
precalculate :employee_average_weekly_earnings do
427-
calculator.employee_average_weekly_earnings
428-
end
429-
end
397+
outcome :not_earned_enough
430398

431399
# Answer 6
432-
outcome :entitled_to_sick_pay do
433-
precalculate :ssp_payment do
434-
calculator.ssp_payment
435-
end
436-
437-
precalculate(:days_paid) { calculator.days_paid }
438-
precalculate(:normal_workdays_out) { calculator.normal_workdays }
439-
precalculate(:pattern_days) { calculator.pattern_days }
440-
precalculate(:pattern_days_total) { calculator.pattern_days_total }
441-
end
400+
outcome :entitled_to_sick_pay
442401

443402
# Answer 7
444-
outcome :not_entitled_3_days_not_paid do
445-
precalculate(:normal_workdays_out) { calculator.normal_workdays }
446-
end
403+
outcome :not_entitled_3_days_not_paid
447404

448405
# Answer 8
449406
outcome :maximum_entitlement_reached

lib/smart_answer_flows/calculate-statutory-sick-pay/outcomes/entitled_to_sick_pay.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<% govspeak_for :body do %>
22
##Statutory Sick Pay (SSP)
33

4-
Your employee is entitled to SSP for <%= days_paid %> days out of <%= normal_workdays_out %> working days taken off sick between <%= format_date(calculator.sick_start_date) %> and <%= format_date(calculator.sick_end_date) %>
4+
Your employee is entitled to SSP for <%= calculator.days_paid %> days out of <%= calculator.normal_workdays %> working days taken off sick between <%= format_date(calculator.sick_start_date) %> and <%= format_date(calculator.sick_end_date) %>
55

66
<% unless calculator.enough_notice_of_absence %>
77
You don’t have to pay until your employee tells you that they’re ill. You’ll have to pay any withheld amounts by the end of your employee's entitlement to sick pay if your employee is sick for more than 28 weeks.
@@ -13,15 +13,15 @@
1313
<% calculator.weekly_payments.each do |week_ending, ssp_amount| %>
1414
<%= format_date(week_ending) %>|<%= format_money(ssp_amount) %>
1515
<% end %>
16-
| **Total SSP: <%= format_money(ssp_payment) %>**
16+
| **Total SSP: <%= format_money(calculator.ssp_payment) %>**
1717

1818
##What you need to know
1919

2020
<% if calculator.paternity_maternity_warning? %>
2121
^ Your employee will not be able to collect Statutory Shared Parental Pay, Statutory Paternity Pay, Statutory Parental Bereavement Pay or Statutory Adoption Pay while collecting Statutory Sick Pay. ^
2222
<% end %>
2323

24-
SSP can be paid for up to 28 weeks of an employee’s normal workdays. For this employee that equals a total of <%= pattern_days_total %> days. After that you must give them [form SSP1](/employers-sick-pay/eligibility-and-form-ssp1) within 7 days of SSP ending. <% if calculator.enough_notice_of_absence %>They may be able to get [Employment Support Allowance (ESA)](/employment-support-allowance).<% end %>
24+
SSP can be paid for up to 28 weeks of an employee’s normal workdays. For this employee that equals a total of <%= calculator.pattern_days_total %> days. After that you must give them [form SSP1](/employers-sick-pay/eligibility-and-form-ssp1) within 7 days of SSP ending. <% if calculator.enough_notice_of_absence %>They may be able to get [Employment Support Allowance (ESA)](/employment-support-allowance).<% end %>
2525

2626

2727

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% govspeak_for :body do %>
2-
Your employee isn’t entitled to Statutory Sick Pay because their average weekly earnings must be at least <%= format_money(lower_earning_limit) %>. Their average weekly earnings are <%= format_money(employee_average_weekly_earnings) %>.
2+
Your employee isn’t entitled to Statutory Sick Pay because their average weekly earnings must be at least <%= format_money(calculator.lower_earning_limit) %>. Their average weekly earnings are <%= format_money(calculator.employee_average_weekly_earnings) %>.
33

44
You must send them [form SSP1](/employers-sick-pay/eligibility-and-form-ssp1) no more than 7 days after they’ve told you they’re sick. They may be able to get [Employment Support Allowance (ESA)](/employment-support-allowance).
55
<% end %>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% govspeak_for :body do %>
22
Your employee isn’t entitled to Statutory Sick Pay because the first 3 days of illness aren’t paid.
33

4-
This employee has taken <%= normal_workdays_out %> working days off sick between <%= format_date(calculator.sick_start_date) %> and <%= format_date(calculator.sick_end_date) %>.
4+
This employee has taken <%= calculator.normal_workdays %> working days off sick between <%= format_date(calculator.sick_start_date) %> and <%= format_date(calculator.sick_end_date) %>.
55
<% end %>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<% text_for :title do %>
2-
What was the last normal payday on or before <%= format_date(pay_day_offset) %>?
2+
What was the last normal payday on or before <%= format_date(calculator.pay_day_offset) %>?
33
<% end %>
44

55
<% text_for :error_message do %>
6-
You must enter a date on or before <%= format_date(pay_day_offset) %>
6+
You must enter a date on or before <%= format_date(calculator.pay_day_offset) %>
77
<% end %>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<% text_for :title do %>
2-
What was the last normal payday before <%= format_date(sick_start_date_for_awe) %>?
2+
What was the last normal payday before <%= format_date(calculator.sick_start_date_for_awe) %>?
33
<% end %>
44

55
<% text_for :hint do %>
66
If you pay someone earlier or later than their normal payday, for example after a bank holiday or due to a factory closure, use the date you'd normally pay them, not the actual payday.
77
<% end %>
88

99
<% text_for :error_message do %>
10-
You must enter a date before <%= format_date(sick_start_date_for_awe) %>
10+
You must enter a date before <%= format_date(calculator.sick_start_date_for_awe) %>
1111
<% end %>

lib/smart_answer_flows/calculate-statutory-sick-pay/questions/paid_at_least_8_weeks.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% text_for :title do %>
2-
On <%= format_date(sick_start_date_for_awe) %> had you paid your employee at least 8 weeks of earnings?
2+
On <%= format_date(calculator.sick_start_date_for_awe) %> had you paid your employee at least 8 weeks of earnings?
33
<% end %>
44

55
<% options(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<% text_for :title do %>
2-
Enter the total earnings paid before <%= format_date(sick_start_date_for_awe) %>.
2+
Enter the total earnings paid before <%= format_date(calculator.sick_start_date_for_awe) %>.
33
<% end %>

lib/smart_answer_flows/calculate-statutory-sick-pay/questions/total_employee_earnings.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% text_for :title do %>
2-
Enter the total amount (before deductions like Income Tax and National Insurance) of your employee’s earnings on paydays between <%= format_date(relevant_period_from) %> and <%= format_date(relevant_period_to) %>.
2+
Enter the total amount (before deductions like Income Tax and National Insurance) of your employee’s earnings on paydays between <%= format_date(calculator.relevant_period_from) %> and <%= format_date(calculator.relevant_period_to) %>.
33
<% end %>
44

55
<% govspeak_for :body do %>

0 commit comments

Comments
 (0)