Skip to content

Commit

Permalink
OP-2301: applied changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sniedzielski committed Jan 9, 2025
1 parent ee6502b commit 939c61b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions calculation/calculation_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ def calculate(cls, instance, **kwargs):
value = float(income) * (rate / 100)
return value
elif context == 'members':
if instance.contract_details.insuree.family:
return list(instance.contract_details.insuree.family.members.filter(validity_to__isnull=True))
cp_params, cd_params = instance.contribution_plan.json_ext, instance.contract_details.json_ext
if (
instance.contract_details.insuree.family
and 'includeFamily' in cp_params
and cp_params['includeFamily']
):
return list(instance.contract_details.insuree.family.members.filter(
validity_to__isnull=True
))
else:
return [instance.contract_details.insuree]
elif context == 'validity':
Expand Down

0 comments on commit 939c61b

Please sign in to comment.