Merge branch 'ticket-28' into 'master'
fixes coupons to better support percentages. Closes #28 See merge request engineering/make-post-sell/make_post_sell!21
This commit is contained in:
commit
ab9c31d8c9
1 changed files with 4 additions and 2 deletions
|
|
@ -111,6 +111,8 @@ class Coupon(RBase, Base):
|
|||
|
||||
if self.action_type == "dollar-off":
|
||||
self.action_value = dollars_to_cents(action_value)
|
||||
elif self.action_type == "percent-off" and action_value > 1:
|
||||
self.action_value = action_value / 100
|
||||
|
||||
if max_redemptions:
|
||||
self.max_redemptions = max_redemptions
|
||||
|
|
@ -139,7 +141,7 @@ class Coupon(RBase, Base):
|
|||
|
||||
@property
|
||||
def is_expired(self):
|
||||
if self.expired_timestamp == None:
|
||||
if self.expired_timestamp is None:
|
||||
return False
|
||||
return now_timestamp() >= self.expired_timestamp
|
||||
|
||||
|
|
@ -158,7 +160,7 @@ class Coupon(RBase, Base):
|
|||
@property
|
||||
def human_discount(self):
|
||||
if self.action_type == "percent-off":
|
||||
return f"{self.action_value}% off"
|
||||
return f"{int(self.action_value * 100)}% off"
|
||||
return f"${cents_to_dollars(self.action_value):.2f} off"
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue