Validate payees

This commit is contained in:
Mark Veidemanis 2023-03-20 14:44:57 +00:00
parent 607eaef264
commit 1dd254a3a7
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 30 additions and 28 deletions

View File

@ -62,36 +62,38 @@ class LinkGroupInfo(LoginRequiredMixin, OTPRequiredMixin, ObjectRead):
pay_list = {}
platform_pay_list = []
for payee in payees["platform"]:
cast = {
"name": payee.name,
"address": payee.address,
"amount": profit_platform / len(payees["platform"]),
"max": profit_platform,
}
if payee not in pay_list:
pay_list[payee] = {}
if "amount" in pay_list[payee]:
pay_list[payee]["amount"] += cast["amount"]
else:
pay_list[payee] = dict(cast)
platform_pay_list.append(cast)
if "platform" in payees:
for payee in payees["platform"]:
cast = {
"name": payee.name,
"address": payee.address,
"amount": profit_platform / len(payees["platform"]),
"max": profit_platform,
}
if payee not in pay_list:
pay_list[payee] = {}
if "amount" in pay_list[payee]:
pay_list[payee]["amount"] += cast["amount"]
else:
pay_list[payee] = dict(cast)
platform_pay_list.append(cast)
requisition_pay_list = []
for payee in payees["requisition"]:
cast = {
"name": payee.name,
"address": payee.address,
"amount": profit_requisition / len(payees["requisition"]),
"max": profit_requisition,
}
if payee not in pay_list:
pay_list[payee] = {}
if "amount" in pay_list[payee]:
pay_list[payee]["amount"] += cast["amount"]
else:
pay_list[payee] = dict(cast)
requisition_pay_list.append(cast)
if "requisition" in payees:
for payee in payees["requisition"]:
cast = {
"name": payee.name,
"address": payee.address,
"amount": profit_requisition / len(payees["requisition"]),
"max": profit_requisition,
}
if payee not in pay_list:
pay_list[payee] = {}
if "amount" in pay_list[payee]:
pay_list[payee]["amount"] += cast["amount"]
else:
pay_list[payee] = dict(cast)
requisition_pay_list.append(cast)
simulation[("Platform", profit_platform)] = platform_pay_list
simulation[("Requisition", profit_requisition)] = requisition_pay_list