Skip to content
Snippets Groups Projects
Commit f2bfe8db authored by magicfelix's avatar magicfelix
Browse files

Fix voucher stuff

parent dc816151
No related branches found
No related tags found
1 merge request!78Resolve "Rewrite registration wizard"
......@@ -131,6 +131,7 @@ class SendEventRegistrationMutation(graphene.Mutation):
event=event,
person=person,
medical_information=event_registration["medical_information"],
donation=0,
**school_details,
)
for field in event.additional_fields.all():
......@@ -145,18 +146,19 @@ class SendEventRegistrationMutation(graphene.Mutation):
registration.cost = event.cost
if event.max_cost is not None and event.max_cost > 0:
if event.max_cost is None or event.max_cost > 0:
amount = event_registration["payment"]["amount"]
if amount < event.cost:
voucher_amount = event.cost - amount
discount = voucher_amount / event.cost
Voucher.objects.create(
discount = voucher_amount / event.cost * 100
voucher = Voucher.objects.create(
person=person,
event=event,
used=True,
discount=discount,
)
registration.voucher = voucher
elif amount > event.cost:
registration.donation = amount - event.cost
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment