showing discounts
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user