forked from MarseyWorld/MarseyWorld
Shop badge discount: fix Spender, add Roller disc.
The shop discount from Big Spender badges was incorrectly implemented: intended behavior was for 2pp per badge. However, the values in const.py were set as if a user could only have one Spender badge at once, while user.py @ discount was implemented as if they were additive. Since users factually do have multiple big spender badges, the values in const were adjusted to reflect this fact. Also, lootbox Roller badges now each offer a 1pp discount. users.py @ discount was improved to check against the `discounts` keys for appropriate badges, rather than a hardcoded list.master
parent
0608e0ce9d
commit
69dec16f55
|
@ -192,7 +192,7 @@ class User(Base):
|
||||||
elif self.patron == 6: discount = 0.65
|
elif self.patron == 6: discount = 0.65
|
||||||
else: discount = 1
|
else: discount = 1
|
||||||
|
|
||||||
for badge in [69,70,71,72,73]:
|
for badge in discounts:
|
||||||
if self.has_badge(badge): discount -= discounts[badge]
|
if self.has_badge(badge): discount -= discounts[badge]
|
||||||
|
|
||||||
return discount
|
return discount
|
||||||
|
|
|
@ -721,11 +721,16 @@ REDDIT_NOTIFS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
discounts = {
|
discounts = {
|
||||||
|
# Big Spender badges, 2pp additive discount each
|
||||||
69: 0.02,
|
69: 0.02,
|
||||||
70: 0.04,
|
70: 0.02,
|
||||||
71: 0.06,
|
71: 0.02,
|
||||||
72: 0.08,
|
72: 0.02,
|
||||||
73: 0.10,
|
73: 0.02,
|
||||||
|
# Lootbox badges, 1pp additive discount each
|
||||||
|
76: 0.01,
|
||||||
|
77: 0.01,
|
||||||
|
78: 0.01,
|
||||||
}
|
}
|
||||||
|
|
||||||
CF_KEY = environ.get("CF_KEY", "").strip()
|
CF_KEY = environ.get("CF_KEY", "").strip()
|
||||||
|
|
Loading…
Reference in New Issue