show tier name in tooltip + standardize patron constants

pull/150/head
Aevann 2023-05-15 01:16:01 +03:00
parent 4735650f77
commit 460a9a686a
5 changed files with 29 additions and 33 deletions

View File

@ -1002,21 +1002,9 @@ class User(Base):
@property
@lazy
def patron_tooltip(self):
if self.patron == 2:
return 'Contributes $5/month'
if self.patron == 3:
return 'Contributes $10/month'
if self.patron == 4:
return 'Contributes $20/month'
if self.patron == 5:
return 'Contributes $50/month'
if self.patron == 6:
return 'Contributes $100/month'
if self.patron == 7:
return 'Contributes $200/month'
if self.patron == 8:
return 'Contributes $500/month'
return ''
tier_name = TIER_TO_NAME(self.patron)
tier_money = TIER_TO_MONEY(self.patron)
return f'{tier_name} - Donates at least ${tier_money}/month'
@classmethod
def can_see_content(cls, user:Optional["User"], other:Union[Submission, Comment, Sub]) -> bool:

View File

@ -700,7 +700,7 @@ LEADERBOARD_LIMIT = PAGE_SIZE
HOUSE_JOIN_COST = 500
HOUSE_SWITCH_COST = 2000
TIERS_ID_TO_NAME = {
TIER_TO_NAME = {
2: "Paypig",
3: "Renthog",
4: "Landchad",
@ -710,6 +710,26 @@ TIERS_ID_TO_NAME = {
8: "Rich Bich",
}
TIER_TO_MONEY = {
2: 5,
3: 10,
4: 20,
5: 50,
6: 100,
7: 200,
8: 500,
}
TIER_TO_MBUX = {
2: 2500,
3: 5000,
4: 10000,
5: 25000,
6: 50000,
7: 100000,
8: 250000,
}
BADGE_BLACKLIST = { # only grantable by admins higher than PERMS['IGNORE_BADGE_BLACKLIST']
1, 2, 6, 10, 11, 12, # Alpha, Verified Email, Beta, Recruiter x3
16, 17, 143, 21, 22, 23, 24, 25, 26, 27, # Marsey Artist x3 / Patron Tiers
@ -899,7 +919,7 @@ elif SITE == 'watchpeopledie.tv':
GIFT_NOTIF_ID = CARP_ID
SIGNUP_FOLLOW_ID = CARP_ID
TIERS_ID_TO_NAME = {
TIER_TO_NAME = {
2: "Victim",
3: "Corpse",
4: "Zombie",

View File

@ -143,7 +143,7 @@ def inject_constants():
"DONATE_LINK":DONATE_LINK, "DONATE_SERVICE":DONATE_SERVICE,
"HOUSE_JOIN_COST":HOUSE_JOIN_COST, "HOUSE_SWITCH_COST":HOUSE_SWITCH_COST, "IMAGE_FORMATS":','.join(IMAGE_FORMATS),
"PAGE_SIZES":PAGE_SIZES, "THEMES":THEMES, "COMMENT_SORTS":COMMENT_SORTS, "SORTS":SORTS,
"TIME_FILTERS":TIME_FILTERS, "HOUSES":HOUSES, "TIERS_ID_TO_NAME":TIERS_ID_TO_NAME,
"TIME_FILTERS":TIME_FILTERS, "HOUSES":HOUSES, "TIER_TO_NAME":TIER_TO_NAME,
"DEFAULT_CONFIG_VALUE":DEFAULT_CONFIG_VALUE, "IS_LOCALHOST":IS_LOCALHOST, "BACKGROUND_CATEGORIES":BACKGROUND_CATEGORIES, "PAGE_SIZE":PAGE_SIZE, "TAGLINES":TAGLINES, "get_alt_graph":get_alt_graph, "current_registered_users":current_registered_users,
"git_head":git_head, "max_days":max_days, "EMOJI_KINDS":EMOJI_KINDS,
"BIO_FRIENDS_ENEMIES_LENGTH_LIMIT":BIO_FRIENDS_ENEMIES_LENGTH_LIMIT,

View File

@ -1318,18 +1318,6 @@ def bid_list(v:User, bid):
tiers={
5: 2,
10: 3,
20: 4,
50: 5,
100: 6,
200: 7,
500: 8,
}
marseybux_li = (0,0,2500,5000,10000,25000,50000,100000,250000)
def claim_rewards(v):
transactions = g.db.query(Transaction).filter_by(email=v.email, claimed=None).all()
@ -1337,11 +1325,11 @@ def claim_rewards(v):
marseybux = 0
for transaction in transactions:
for money, t in tiers.items():
for t, money in TIER_TO_MONEY.items():
if transaction.amount < money: break
tier = t
marseybux += marseybux_li[tier]
marseybux += TIER_TO_MARSEYBUX[tier]
if tier > highest_tier:
highest_tier = tier
transaction.claimed = True

View File

@ -15,7 +15,7 @@
<label for="patron-status">{{patron}} Status</label>
</div>
<div class="body w-lg-100">
<p>You're a {{TIERS_ID_TO_NAME[v.patron] if v.patron else "freeloader"}}!</p>{% if v.patron %} Thanks ily! &lt;3{% endif %}
<p>You're a {{TIER_TO_NAME[v.patron] if v.patron else "freeloader"}}!</p>{% if v.patron %} Thanks ily! &lt;3{% endif %}
{% if not v.patron and v.truescore >= TRUESCORE_DONATE_MINIMUM %}
<p class="font-italic">To stop freeloading, first <a href="/settings/security#new_email">verify your email</a>, support us on <a href="{{DONATE_LINK}}">{{DONATE_SERVICE}}</a> with the same email, and click "Claim {{patron}} Rewards"</p>
{% elif not v.patron %}