Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-2301: fixed calculating amounts, fixed displaying CP params #69

Closed
wants to merge 5 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions calculation/calculation_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from policyholder.models import PolicyHolderInsuree
from uuid import UUID


class ContributionValuationRule(AbsStrategy):
version = 1
uuid = "0e1b6dd4-04a0-4ee6-ac47-2a99cfa5e9a8"
Expand Down Expand Up @@ -101,18 +102,10 @@ def calculate(cls, instance, **kwargs):
value = float(income) * (rate / 100)
return value
elif context == 'members':
cp_params, cd_params = instance.contribution_plan.json_ext, instance.contract_details.json_ext
sniedzielski marked this conversation as resolved.
Show resolved Hide resolved
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
))
if instance.contract_details.insuree.family:
return list(instance.contract_details.insuree.family.members.filter(validity_to__isnull=True))
else:
return [instance.contract_details.insuree]

elif context == 'validity':
validity_from = kwargs.get('validity_from', None)
validity_to = kwargs.get('validity_to', None)
Expand All @@ -123,8 +116,6 @@ def calculate(cls, instance, **kwargs):
contract = instance.contract_details.contract
if instance.__class__.__name__ == "ContractDetails":
contract = instance.contract


if contract:
validity_from = validity_from or contract.date_valid_from
validity_to = validity_to or contract.date_valid_to
Expand Down
Loading