rename truecoins to truescore
parent
be2b4b6b59
commit
0fffa7efc0
|
@ -107,7 +107,7 @@ class User(Base):
|
|||
club_allowed = Column(Boolean)
|
||||
login_nonce = Column(Integer, default=0)
|
||||
coins = Column(Integer, default=0)
|
||||
truecoins = Column(Integer, default=0)
|
||||
truescore = Column(Integer, default=0)
|
||||
procoins = Column(Integer, default=0)
|
||||
mfa_secret = deferred(Column(String))
|
||||
is_private = Column(Boolean, default=False)
|
||||
|
@ -424,7 +424,7 @@ class User(Base):
|
|||
if not FEATURES['COUNTRY_CLUB']: return True
|
||||
if self.shadowbanned: return False
|
||||
if self.is_suspended_permanently: return False
|
||||
return self.admin_level >= PERMS['VIEW_CLUB'] or self.club_allowed or (self.club_allowed != False and self.truecoins >= DUES)
|
||||
return self.admin_level >= PERMS['VIEW_CLUB'] or self.club_allowed or (self.club_allowed != False and self.truescore >= DUES)
|
||||
|
||||
@lazy
|
||||
def any_block_exists(self, other):
|
||||
|
@ -937,7 +937,7 @@ class User(Base):
|
|||
def can_see_chudrama(self):
|
||||
if self.admin_level >= PERMS['VIEW_CHUDRAMA']: return True
|
||||
if self.client: return True
|
||||
if self.truecoins >= 5000: return True
|
||||
if self.truescore >= 5000: return True
|
||||
if self.agendaposter: return True
|
||||
if self.patron: return True
|
||||
return False
|
||||
|
|
|
@ -450,7 +450,7 @@ def execute_pizza_autovote(v:User, target:Union[Submission, Comment]):
|
|||
autovote.created_utc += 1
|
||||
g.db.add(autovote)
|
||||
v.coins += votes
|
||||
v.truecoins += votes
|
||||
v.truescore += votes
|
||||
g.db.add(v)
|
||||
target.upvotes += votes
|
||||
g.db.add(target)
|
||||
|
|
|
@ -136,10 +136,10 @@ def stats(site=None):
|
|||
"House femboy members": "{:,}".format(g.db.query(User).filter(User.house.like('Femboy%')).count()),
|
||||
"House vampire members": "{:,}".format(g.db.query(User).filter(User.house.like('Vampire%')).count()),
|
||||
"House racist members": "{:,}".format(g.db.query(User).filter(User.house.like('Racist%')).count()),
|
||||
"House furry total truescore": "{:,}".format(g.db.query(func.sum(User.truecoins)).filter(User.house.like('Furry%')).scalar() or 0),
|
||||
"House femboy total truescore": "{:,}".format(g.db.query(func.sum(User.truecoins)).filter(User.house.like('Femboy%')).scalar() or 0),
|
||||
"House vampire total truescore": "{:,}".format(g.db.query(func.sum(User.truecoins)).filter(User.house.like('Vampire%')).scalar() or 0),
|
||||
"House racist total truescore": "{:,}".format(g.db.query(func.sum(User.truecoins)).filter(User.house.like('Racist%')).scalar() or 0),
|
||||
"House furry total truescore": "{:,}".format(g.db.query(func.sum(User.truescore)).filter(User.house.like('Furry%')).scalar() or 0),
|
||||
"House femboy total truescore": "{:,}".format(g.db.query(func.sum(User.truescore)).filter(User.house.like('Femboy%')).scalar() or 0),
|
||||
"House vampire total truescore": "{:,}".format(g.db.query(func.sum(User.truescore)).filter(User.house.like('Vampire%')).scalar() or 0),
|
||||
"House racist total truescore": "{:,}".format(g.db.query(func.sum(User.truescore)).filter(User.house.like('Racist%')).scalar() or 0),
|
||||
}
|
||||
stats.update(stats2)
|
||||
|
||||
|
|
|
@ -77,12 +77,12 @@ def get_logged_in_user():
|
|||
g.db.add(v)
|
||||
|
||||
if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG':
|
||||
if v and not v.username.startswith('Aev') and v.truecoins > 0:
|
||||
if v and not v.username.startswith('Aev') and v.truescore > 0:
|
||||
with open(f"/eg", "r+", encoding="utf-8") as f:
|
||||
ip = request.headers.get('CF-Connecting-IP')
|
||||
if f'@{v.username}, ' not in f.read():
|
||||
t = str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())))
|
||||
f.write(f'@{v.username}, {v.truecoins}, {ip}, {t}\n')
|
||||
f.write(f'@{v.username}, {v.truescore}, {ip}, {t}\n')
|
||||
|
||||
return v
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ def kippy(v):
|
|||
@admin_level_required(PERMS['VIEW_ACTIVE_USERS'])
|
||||
def loggedin_list(v):
|
||||
ids = [x for x,val in cache.get(f'{SITE}_loggedin').items() if time.time()-val < LOGGEDIN_ACTIVE_TIME]
|
||||
users = g.db.query(User).filter(User.id.in_(ids)).order_by(User.admin_level.desc(), User.truecoins.desc()).all()
|
||||
users = g.db.query(User).filter(User.id.in_(ids)).order_by(User.admin_level.desc(), User.truescore.desc()).all()
|
||||
return render_template("loggedin.html", v=v, users=users)
|
||||
|
||||
@app.get('/admin/loggedout')
|
||||
|
@ -91,7 +91,7 @@ def merge(v, id1, id2):
|
|||
g.db.add(exile)
|
||||
g.db.flush()
|
||||
|
||||
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truecoins', 'procoins'):
|
||||
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truescore', 'procoins'):
|
||||
amount = getattr(user1, kind) + getattr(user2, kind)
|
||||
setattr(user1, kind, amount)
|
||||
setattr(user2, kind, 0)
|
||||
|
@ -141,7 +141,7 @@ def merge_all(v, id):
|
|||
g.db.flush()
|
||||
|
||||
for alt in user.alts_unique:
|
||||
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truecoins', 'procoins'):
|
||||
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truescore', 'procoins'):
|
||||
amount = getattr(user, kind) + getattr(alt, kind)
|
||||
setattr(user, kind, amount)
|
||||
setattr(alt, kind, 0)
|
||||
|
|
|
@ -113,9 +113,9 @@ def patrons(v):
|
|||
@auth_required
|
||||
def admins(v):
|
||||
if v.admin_level >= PERMS['VIEW_SORTED_ADMIN_LIST']:
|
||||
admins = g.db.query(User).filter(User.admin_level>1).order_by(User.truecoins.desc()).all()
|
||||
admins += g.db.query(User).filter(User.admin_level==1).order_by(User.truecoins.desc()).all()
|
||||
else: admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truecoins.desc()).all()
|
||||
admins = g.db.query(User).filter(User.admin_level>1).order_by(User.truescore.desc()).all()
|
||||
admins += g.db.query(User).filter(User.admin_level==1).order_by(User.truescore.desc()).all()
|
||||
else: admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truescore.desc()).all()
|
||||
return render_template("admins.html", v=v, admins=admins)
|
||||
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ def leaderboard(v):
|
|||
comments = Leaderboard("Comments", "comment count", "comments", "Comments", "comments", Leaderboard.get_simple_lb, User.comment_count, v, lambda u:u.comment_count, g.db, users)
|
||||
received_awards = Leaderboard("Awards", "received awards", "awards", "Awards", None, Leaderboard.get_simple_lb, User.received_award_count, v, lambda u:u.received_award_count, g.db, users)
|
||||
coins_spent = Leaderboard("Spent in shop", "coins spent in shop", "spent", "Coins", None, Leaderboard.get_simple_lb, User.coins_spent, v, lambda u:u.coins_spent, g.db, users)
|
||||
truecoins = Leaderboard("Truescore", "truescore", "truescore", "Truescore", None, Leaderboard.get_simple_lb, User.truecoins, v, lambda u:u.truecoins, g.db, users)
|
||||
truescore = Leaderboard("Truescore", "truescore", "truescore", "Truescore", None, Leaderboard.get_simple_lb, User.truescore, v, lambda u:u.truescore, g.db, users)
|
||||
|
||||
badges = Leaderboard("Badges", "badges", "badges", "Badges", None, Leaderboard.get_badge_marsey_lb, Badge.user_id, v, None, g.db, None)
|
||||
marseys = Leaderboard("Marseys", "Marseys made", "marseys", "Marseys", None, Leaderboard.get_badge_marsey_lb, Marsey.author_id, v, None, g.db, None) if SITE_NAME == 'rDrama' else None
|
||||
|
@ -346,7 +346,7 @@ def leaderboard(v):
|
|||
owned_hats = Leaderboard("Owned hats", "owned hats", "owned-hats", "Owned Hats", None, Leaderboard.get_hat_lb, User.owned_hats, v, None, g.db, None)
|
||||
designed_hats = Leaderboard("Designed hats", "designed hats", "designed-hats", "Designed Hats", None, Leaderboard.get_hat_lb, User.designed_hats, v, None, g.db, None)
|
||||
|
||||
leaderboards = [coins, coins_spent, truecoins, subscribers, posts, comments, received_awards, badges, marseys, blocks, owned_hats, designed_hats]
|
||||
leaderboards = [coins, coins_spent, truescore, subscribers, posts, comments, received_awards, badges, marseys, blocks, owned_hats, designed_hats]
|
||||
|
||||
return render_template("leaderboard.html", v=v, leaderboards=leaderboards)
|
||||
|
||||
|
|
|
@ -80,14 +80,14 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
|
|||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
target.author.coins += coin_value
|
||||
target.author.truecoins += coin_delta
|
||||
target.author.truescore += coin_delta
|
||||
g.db.add(target.author)
|
||||
existing.vote_type = new
|
||||
existing.coins = coin_value
|
||||
g.db.add(existing)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
target.author.charge_account('coins', existing.coins, should_check_balance=False)
|
||||
target.author.truecoins -= coin_delta
|
||||
target.author.truescore -= coin_delta
|
||||
g.db.add(target.author)
|
||||
g.db.delete(existing)
|
||||
else:
|
||||
|
@ -95,7 +95,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
|
|||
g.db.add(existing)
|
||||
elif new != 0:
|
||||
target.author.coins += coin_value
|
||||
target.author.truecoins += coin_delta
|
||||
target.author.truescore += coin_delta
|
||||
g.db.add(target.author)
|
||||
|
||||
real = new != 1 or v.is_votes_real
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<tr>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
<td style="text-align:right;">{{"{:,}".format(user.truecoins)}}</td>
|
||||
<td style="text-align:right;">{{"{:,}".format(user.truescore)}}</td>
|
||||
<td style="text-align:right;"><a href="/log?admin={{user.username}}">{{"{:,}".format(user.modaction_num)}}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="overflow-x-auto">
|
||||
<table class="table table-striped mb-5">
|
||||
<tbody>
|
||||
{% if v and v.truecoins >= TRUESCORE_DONATE_LIMIT %}
|
||||
{% if v and v.truescore >= TRUESCORE_DONATE_LIMIT %}
|
||||
<tr>
|
||||
<td>Kofi</td>
|
||||
<td><a rel="nofollow noopener" href="{{KOFI_LINK}}">{{KOFI_LINK}}</a></td>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="overflow-x-auto">
|
||||
<table class="table table-striped mb-5">
|
||||
<tbody>
|
||||
{% if v and v.truecoins >= TRUESCORE_DONATE_LIMIT %}
|
||||
{% if v and v.truescore >= TRUESCORE_DONATE_LIMIT %}
|
||||
<tr>
|
||||
<td>Gumroad</td>
|
||||
<td><a rel="nofollow noopener" href="{{GUMROAD_LINK}}">{{GUMROAD_LINK}}</a></td>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<img alt=":#marseymerchant:" loading="lazy" class="mb-2" src="/e/marseymerchant.webp">
|
||||
<h5>401 Not Authorized</h5>
|
||||
<p class="text-muted">This page is only available to {% if SITE_NAME == 'rDrama' %}paypigs{% else %}patrons{% endif %}:</p>
|
||||
{% if FEATURES['PROCOINS'] and v.truecoins -%}
|
||||
{% if FEATURES['PROCOINS'] and v.truescore -%}
|
||||
{% if KOFI_LINK %}
|
||||
<a rel="nofollow noopener" href="{{KOFI_LINK}}">{{KOFI_LINK}}</a>
|
||||
{% else %}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<tr>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
<td>{{"{:,}".format(user.truecoins)}}</td>
|
||||
<td>{{"{:,}".format(user.truescore)}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
{% include "user_in_table.html" %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>{{"{:,}".format(vote.user.truecoins)}}</td>
|
||||
<td>{{"{:,}".format(vote.user.truescore)}}</td>
|
||||
<td data-time="{{vote.created_utc}}"></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</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! <3{% endif %}
|
||||
{% if not v.patron and v.truecoins >= TRUESCORE_DONATE_LIMIT %}
|
||||
{% if not v.patron and v.truescore >= TRUESCORE_DONATE_LIMIT %}
|
||||
<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 %}
|
||||
<p class="font-italic">To stop freeloading, you can <a href="/donate">donate via crypto</a>. Please let us know first beforehand by <a href="/contact">sending us a modmail.</a> Thanks!</p>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
{% if FEATURES['PROCOINS'] %}
|
||||
<span class="text-small text-muted pl-1">Must be same email as the one you used to donate
|
||||
{% if v.truecoins >= TRUESCORE_DONATE_LIMIT %}
|
||||
{% if v.truescore >= TRUESCORE_DONATE_LIMIT %}
|
||||
on
|
||||
{% if KOFI_TOKEN %}
|
||||
<a rel="nofollow noopener" class="text-primary" href="{{KOFI_LINK}}">Kofi</a>
|
||||
|
|
|
@ -223,7 +223,7 @@
|
|||
<div class="mt-2" id="profile--info">
|
||||
<p id="profile--info--id">User ID: {{u.id}}</p>
|
||||
<p id="profile--info--spent">Coins spent: {{u.coins_spent}}</p>
|
||||
<p id="profile--info--truescore">True score: {{u.truecoins}}</p>
|
||||
<p id="profile--info--truescore">True score: {{u.truescore}}</p>
|
||||
<p id="profile--info--winnings">Winnings: {{u.winnings}}</p>
|
||||
<p id="profile--info--hats-owned" {% if u.num_of_owned_hats >= hats_total %}class="profile-owned-all-hats"{% endif %}>{{u.num_of_owned_hats}} / {{hats_total}} hats owned ({{hats_owned_percent}})</p>
|
||||
{% if u.is_private %}
|
||||
|
@ -462,7 +462,7 @@
|
|||
<div class="mt-2" id="profile-mobile--info">
|
||||
<p id="profile-mobile--info--id">User ID: {{u.id}}</p>
|
||||
<p id="profile-mobile--info--spent">Coins spent: {{u.coins_spent}}</p>
|
||||
<p id="profile-mobile--info--truescore">True score: {{u.truecoins}}</p>
|
||||
<p id="profile-mobile--info--truescore">True score: {{u.truescore}}</p>
|
||||
<p id="profile-mobile--info--winnings">Winnings: {{u.winnings}}</p>
|
||||
<p id="profile-mobile--info--hats-owned" {% if u.num_of_owned_hats >= hats_total %}class="profile-owned-all-hats"{% endif %}>{{u.num_of_owned_hats}} / {{hats_total}} hats owned ({{hats_owned_percent}})</p>
|
||||
{% if u.is_private %}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<p><a href="{{thing.permalink}}">{{thing.permalink}}</a></p>
|
||||
<p><b>Author:</b> <a href="{{thing.author.url}}">@{{thing.author.username}}</a></p>
|
||||
<p><b>Author Created At:</b> <span data-time="{{thing.author.created_utc}}"></span></p>
|
||||
<p><b>Author Truescore:</b> {{"{:,}".format(thing.author.truecoins)}}</p>
|
||||
<p><b>Author Truescore:</b> {{"{:,}".format(thing.author.truescore)}}</p>
|
||||
<p><b>Upvotes: </b>{{ups | length}}</p>
|
||||
<p><b>Downvotes: </b>{{downs | length}}</p>
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
{% include "user_in_table.html" %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>{{"{:,}".format(vote.user.truecoins)}}</td>
|
||||
<td>{{"{:,}".format(vote.user.truescore)}}</td>
|
||||
<td {% if vote.created_utc > 1599343262 %}data-time="{{vote.created_utc}}"{% endif %}></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -64,7 +64,7 @@
|
|||
{% include "user_in_table.html" %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>{{"{:,}".format(vote.user.truecoins)}}</td>
|
||||
<td>{{"{:,}".format(vote.user.truescore)}}</td>
|
||||
<td {% if vote.created_utc > 1599343262 %}data-time="{{vote.created_utc}}"{% endif %}></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue