Skip to content

Commit 00f4f4e

Browse files
committed
Remove question if you are an apprentice if checking national living wage eligibility and related regression test artefacts. Add validation to how old are you when checking living wage eligibility to ensure users are at least 25 before continuing.
1 parent df4d22c commit 00f4f4e

File tree

138 files changed

+65
-7018
lines changed

Some content is hidden

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

138 files changed

+65
-7018
lines changed

lib/smart_answer/calculators/minimum_wage_calculator.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def valid_accommodation_usage?(accommodation_usage)
4949
accommodation_usage >= 0 && accommodation_usage <= 7
5050
end
5151

52+
def valid_age_for_living_wage?(age)
53+
age.to_i >= 25
54+
end
55+
5256
def basic_rate
5357
rate = @basic_pay / @basic_hours
5458
if overtime_hours > 0 and overtime_hourly_rate > 0 and rate > overtime_hourly_rate
@@ -171,7 +175,7 @@ def apprentice_eligible_for_minimum_wage?
171175
end
172176

173177
def eligible_for_living_wage?
174-
age.to_i >= 25
178+
valid_age_for_living_wage?(age)
175179
end
176180

177181
def under_school_leaving_age?

lib/smart_answer_flows/locales/en/am-i-getting-minimum-wage.yml

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ en-GB:
4545
title: "%{age_title}"
4646
suffix_label: years old
4747
error_message: Please enter a whole number greater than 0
48+
valid_age_for_living_wage?: You must be 25 or over to get the national living wage
4849
# Q3 Past
4950
how_old_were_you?:
5051
title: How old were you at the time?

lib/smart_answer_flows/shared_logic/minimum_wage.rb

+12-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010

1111
permitted_next_nodes = [
1212
:are_you_an_apprentice?,
13+
:how_old_are_you?,
1314
:past_payment_date?
1415
]
1516

1617
next_node(permitted: permitted_next_nodes) do |response|
1718
case response
18-
when 'current_payment', 'current_payment_april_2016'
19+
when 'current_payment'
1920
:are_you_an_apprentice?
21+
when 'current_payment_april_2016'
22+
:how_old_are_you?
2023
when 'past_payment'
2124
:past_payment_date?
2225
end
@@ -107,6 +110,14 @@
107110
calculator.valid_age?(response)
108111
end
109112

113+
validate :valid_age_for_living_wage? do |response|
114+
if calculator.what_to_check == 'current_payment_april_2016'
115+
calculator.valid_age_for_living_wage?(response)
116+
else
117+
true
118+
end
119+
end
120+
110121
permitted_next_nodes = [
111122
:under_school_leaving_age,
112123
:how_often_do_you_get_paid?
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $C
66

77
The national living wage per hour for your age will be | Your actual pay
88
- | -
9-
£7.20 | £18.75
9+
£7.20 | £17.50
1010

1111
If you work overtime or your employer provides you with [accommodation](/national-minimum-wage-accommodation), this has been added to the calculation.
1212

Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $C
66

77
The national living wage per hour for your age will be | Your actual pay
88
- | -
9-
£7.20 | £10
9+
£7.20 | £12
1010

1111
If you work overtime or your employer provides you with [accommodation](/national-minimum-wage-accommodation), this has been added to the calculation.
1212

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/100.0/0.0/no.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/100.0/0.0/yes_charged/5.0/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/100.0/0.0/yes_charged/50.0/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/100.0/0.0/yes_free/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/100.0/8.0/10.0/no.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/100.0/8.0/10.0/yes_charged/5.0/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/100.0/8.0/10.0/yes_charged/50.0/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/100.0/8.0/10.0/yes_free/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/300.0/0.0/no.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/300.0/0.0/yes_charged/5.0/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/300.0/0.0/yes_charged/50.0/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/300.0/0.0/yes_free/5.txt

-22
This file was deleted.

test/artefacts/am-i-getting-minimum-wage/current_payment_april_2016/apprentice_over_19_first_year/1/16.0/300.0/8.0/10.0/no.txt

-22
This file was deleted.

0 commit comments

Comments
 (0)