Skip to content
Snippets Groups Projects
Commit 6370699c authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Fix individual cost for logged in users

parent e2bff3cd
No related branches found
No related tags found
No related merge requests found
......@@ -192,11 +192,10 @@ class Event(ExtensibleModel):
return reverse("event_by_name", kwargs={"slug": self.slug})
def individual_cost(self, request=None):
if request and request.user.is_authenticated:
if Voucher.objects.filter(event=self, person=request.user.person, used=False).exists():
voucher = Voucher.objects.get(event=self, person=request.user.person, used=False)
individual_cost = voucher.discount * self.cost / 100
return individual_cost
if request and request.user.is_authenticated and Voucher.objects.filter(event=self, person=request.user.person, used=False).exists():
voucher = Voucher.objects.get(event=self, person=request.user.person, used=False)
individual_cost = voucher.discount * self.cost / 100
return individual_cost
else:
return self.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