Private
Public Access
1
0

showing discounts

This commit is contained in:
Sander Roosendaal
2021-11-11 11:09:27 +01:00
parent 72c1817c15
commit 6742f81fe3
5 changed files with 44 additions and 1 deletions

View File

@@ -1,4 +1,3 @@
from rowers.models import Rower
class InsufficientCreditError(Exception):
"""Raised when trying to subtract more than available"""
@@ -24,3 +23,19 @@ def withdraw(amount, rower):
return rower.eurocredits
return rower.eurocredits
def discount(amount,rower):
if amount < rower.eurocredits:
return amount
else:
return rower.eurocredits
return 0
def discounted(amount,rower):
if amount > rower.eurocredits:
return amount-rower.eurocredits
else:
return 0
return 0