remove liara.json & workflow/liara.yaml - add Dockerfile & docker-compose file
This commit is contained in:
@@ -47,22 +47,51 @@ def pos_organizations_sharing_information(
|
||||
})
|
||||
|
||||
# if device owner is an agency organization
|
||||
# if owner_org.type.name == 'AGC':
|
||||
agc_share_amount = owner_org.pos_stake_holders.filter(
|
||||
if owner_org.type.name == 'AGC':
|
||||
sharing_information_list = agency_organization_pos_info(
|
||||
agency=owner_org,
|
||||
pos_sharing_list=sharing_information_list,
|
||||
device=device,
|
||||
distribution=distribution
|
||||
)
|
||||
|
||||
return sharing_information_list
|
||||
|
||||
|
||||
def agency_organization_pos_info(
|
||||
agency: Organization = None,
|
||||
pos_sharing_list: list = None,
|
||||
device: Device = None,
|
||||
distribution: QuotaDistribution = None
|
||||
) -> typing.Any:
|
||||
"""
|
||||
if pos org owner is an agency, calculate share amount of agency
|
||||
and share amount of parent organization
|
||||
"""
|
||||
|
||||
# get agency share amount
|
||||
agc_share_amount = agency.pos_stake_holders.filter(
|
||||
device=device,
|
||||
).first().holders_share_amount.filter(
|
||||
quota_distribution=distribution
|
||||
)
|
||||
sharing_information_list.append({
|
||||
"organization_name": owner_org.name,
|
||||
"bank_account": {
|
||||
"credit_card": owner_org.bank_information.first().card,
|
||||
"sheba": owner_org.bank_information.first().sheba,
|
||||
"account": owner_org.bank_information.first().account,
|
||||
} if owner_org.bank_information.exists() else {},
|
||||
"amount": agc_share_amount.first().share_amount if agc_share_amount else None,
|
||||
"agency": True,
|
||||
"default_account": True
|
||||
})
|
||||
agc_share_amount = agc_share_amount.first().share_amount if agc_share_amount else None
|
||||
|
||||
return sharing_information_list
|
||||
# calculate agency parent share amount
|
||||
agc_parent_amount = next((item for item in pos_sharing_list if item.get('default_account')), None)
|
||||
if agc_parent_amount and agc_share_amount:
|
||||
agc_parent_amount['amount'] = agc_parent_amount['amount'] - agc_share_amount
|
||||
|
||||
pos_sharing_list.append({
|
||||
"organization_name": agency.name,
|
||||
"bank_account": {
|
||||
"credit_card": agency.bank_information.first().card,
|
||||
"sheba": agency.bank_information.first().sheba,
|
||||
"account": agency.bank_information.first().account,
|
||||
} if agency.bank_information.exists() else {},
|
||||
"amount": agc_share_amount,
|
||||
"agency": True,
|
||||
"default_account": True
|
||||
})
|
||||
|
||||
return pos_sharing_list
|
||||
|
||||
Reference in New Issue
Block a user