Skip to content

Commit fc83a03

Browse files
committed
Edit for test passing
1 parent e0221f8 commit fc83a03

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

policyengine_uk/variables/gov/hmrc/tax_free_childcare/conditions/childcare_age_child_condition.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from policyengine_uk.model_api import *
22

3-
43
class child_age_eligible(Variable):
54
value_type = bool
65
entity = Person
@@ -32,14 +31,15 @@ def formula(person, period, parameters):
3231
standard_disability_benefits = gc.eligibility
3332
severe_disability_benefits = gc.severe.eligibility
3433

35-
is_disabled = (
36-
add(person, period, standard_disability_benefits)
37-
| add(person, period, severe_disability_benefits)
38-
) > 0
34+
# Convert to boolean arrays before combining
35+
standard_benefits = add(person, period, standard_disability_benefits).astype(bool)
36+
severe_benefits = add(person, period, severe_disability_benefits).astype(bool)
37+
is_disabled = (standard_benefits | severe_benefits)
3938

4039
# Check age conditions using parameterized values
4140
basic_age_condition = age < standard_age_limit
4241
age_under_disability_limit = age < disability_age_limit
4342

44-
# Combine conditions
45-
return basic_age_condition | (age_under_disability_limit & is_disabled)
43+
# Convert to boolean before final combination
44+
return (basic_age_condition.astype(bool) |
45+
(age_under_disability_limit.astype(bool) & is_disabled))

0 commit comments

Comments
 (0)