Skip to content

Commit d7da0a9

Browse files
authored
Merge pull request #5271 from alphagov/DGarland5-patch-4
Update results.erb
2 parents 9ebaaa7 + a7efb09 commit d7da0a9

File tree

7 files changed

+285
-115
lines changed

7 files changed

+285
-115
lines changed

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
source "https://rubygems.org"
22

3+
ruby File.read(".ruby-version").chomp
4+
35
gem "rails", "6.0.3.2"
46

57
gem "ast"

Gemfile.lock

+3
Original file line numberDiff line numberDiff line change
@@ -442,5 +442,8 @@ DEPENDENCIES
442442
uk_postcode
443443
webmock
444444

445+
RUBY VERSION
446+
ruby 2.7.2p137
447+
445448
BUNDLED WITH
446449
2.1.4

lib/smart_answer/calculators/business_coronavirus_support_finder_calculator.rb

+20-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class BusinessCoronavirusSupportFinderCalculator
1010

1111
def initialize
1212
@closed_by_restrictions = []
13+
@sectors = []
1314
end
1415

1516
RULES = {
@@ -20,10 +21,6 @@ def initialize
2021
calculator.business_size == "0_to_249" &&
2122
calculator.paye_scheme == "yes"
2223
},
23-
christmas_pub_payment: lambda { |calculator|
24-
calculator.business_based == "england" &&
25-
calculator.sectors.include?("retail_hospitality_or_leisure")
26-
},
2724
retail_hospitality_leisure_business_rates: lambda { |calculator|
2825
calculator.business_based == "england" &&
2926
calculator.non_domestic_property != "no" &&
@@ -46,6 +43,9 @@ def initialize
4643
kickstart_scheme: lambda { |calculator|
4744
calculator.business_based != "northern_ireland"
4845
},
46+
vat_reduction: lambda { |calculator|
47+
calculator.sectors.include?("retail_hospitality_or_leisure")
48+
},
4949
lrsg_closed_addendum: lambda { |calculator|
5050
calculator.business_based == "england" &&
5151
calculator.closed_by_restrictions.include?("national")
@@ -65,6 +65,22 @@ def initialize
6565
additional_restrictions_grant: lambda { |calculator|
6666
calculator.business_based == "england"
6767
},
68+
restart_grant: lambda { |calculator|
69+
calculator.business_based == "england" &&
70+
calculator.sectors.intersection(%w[retail_hospitality_or_leisure personal_care]).any?
71+
},
72+
council_grants: lambda { |calculator|
73+
council_grant_questions = %i[lrsg_closed_addendum
74+
lrsg_closed
75+
lrsg_open
76+
lrsg_sector
77+
additional_restrictions_grant
78+
retail_hospitality_leisure_business_rates
79+
nursery_support
80+
restart_grant]
81+
82+
council_grant_questions.any? { |q| calculator.show?(q) }
83+
},
6884
}.freeze
6985

7086
def show?(result_id)

lib/smart_answer_flows/business-coronavirus-support-finder.rb

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def define
8181
option :nurseries
8282
option :retail_hospitality_or_leisure
8383
option :nightclubs_or_adult_entertainment
84+
option :personal_care
8485
none_option
8586

8687
on_response do |response|

lib/smart_answer_flows/business-coronavirus-support-finder/outcomes/results.erb

+209-89
Large diffs are not rendered by default.

lib/smart_answer_flows/business-coronavirus-support-finder/questions/sectors.erb

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
<% options(
1010
"nurseries": "Nurseries",
11-
"retail_hospitality_or_leisure": "Retail, hospitality or leisure (including pubs)",
11+
"retail_hospitality_or_leisure": "Retail, hospitality or leisure (including pubs and gyms)",
1212
"nightclubs_or_adult_entertainment": "Nightclub, dancehall, or adult entertainment venue",
13+
"personal_care": "Personal Care",
1314
"none": "None of the above",
1415
) %>

test/unit/calculators/business_coronavirus_support_calculator_test.rb

+48-21
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,6 @@ class BusinessCoronavirusSupportFinderCalculatorTest < ActiveSupport::TestCase
4040
end
4141
end
4242

43-
context "christmas_pub_payment" do
44-
setup do
45-
@calculator.business_based = "england"
46-
@calculator.sectors = %w[retail_hospitality_or_leisure]
47-
end
48-
49-
should "return true when criteria met" do
50-
assert @calculator.show?(:retail_hospitality_leisure_business_rates)
51-
end
52-
53-
should "return false when in a devolved admininstration" do
54-
@calculator.business_based = "scotland"
55-
assert_not @calculator.show?(:retail_hospitality_leisure_business_rates)
56-
end
57-
58-
should "return false when not supported business sectors" do
59-
@calculator.sectors = %w[none]
60-
assert_not @calculator.show?(:retail_hospitality_leisure_business_rates)
61-
end
62-
end
63-
6443
context "retail_hospitality_leisure_business_rates" do
6544
setup do
6645
@calculator.business_based = "england"
@@ -178,6 +157,17 @@ class BusinessCoronavirusSupportFinderCalculatorTest < ActiveSupport::TestCase
178157
end
179158
end
180159

160+
context "vat_reduction" do
161+
should "return true when business is in the retail sector" do
162+
@calculator.sectors = %w[retail_hospitality_or_leisure]
163+
assert @calculator.show?(:vat_reduction)
164+
end
165+
166+
should "return false when business is not in the retail sector" do
167+
assert_not @calculator.show?(:vat_reduction)
168+
end
169+
end
170+
181171
context "lrsg_closed_addendum" do
182172
should "return true when business closed by national restrictions and based in england" do
183173
@calculator.business_based = "england"
@@ -269,6 +259,43 @@ class BusinessCoronavirusSupportFinderCalculatorTest < ActiveSupport::TestCase
269259
assert_not @calculator.show?(:additional_restrictions_grant)
270260
end
271261
end
262+
263+
context "restart_grant" do
264+
should "return true when business is based in England and in the retail sector" do
265+
@calculator.business_based = "england"
266+
@calculator.sectors = %w[retail_hospitality_or_leisure]
267+
assert @calculator.show?(:restart_grant)
268+
end
269+
270+
should "return true when business is based in England and in the personal care sector" do
271+
@calculator.business_based = "england"
272+
@calculator.sectors = %w[personal_care]
273+
assert @calculator.show?(:restart_grant)
274+
end
275+
276+
should "return false when business not based in England" do
277+
@calculator.business_based = "scotland"
278+
@calculator.sectors = %w[retail_hospitality_or_leisure]
279+
assert_not @calculator.show?(:restart_grant)
280+
end
281+
282+
should "return false when business is based in England but not in a qualifying sector" do
283+
@calculator.business_based = "england"
284+
assert_not @calculator.show?(:restart_grant)
285+
end
286+
end
287+
288+
context "council_grants" do
289+
should "return true for one of the council grant rules" do
290+
# meeting criteria for additional_restrictions_grant
291+
@calculator.business_based = "england"
292+
assert @calculator.show?(:council_grants)
293+
end
294+
295+
should "return false for other rules" do
296+
assert_not @calculator.show?(:council_grants)
297+
end
298+
end
272299
end
273300
end
274301
end

0 commit comments

Comments
 (0)