fdfd
This commit is contained in:
parent
f945893cef
commit
c26fdd1ae9
2 changed files with 8 additions and 11 deletions
|
@ -86,6 +86,7 @@ class User(Base, Stndrd, Age_times):
|
|||
reserved = Column(String(256), default=None)
|
||||
is_nsfw = Column(Boolean, default=False)
|
||||
profile_nonce = Column(Integer, default=0)
|
||||
dramacoins = Column(Integer, default=0)
|
||||
banner_nonce = Column(Integer, default=0)
|
||||
last_siege_utc = Column(Integer, default=0)
|
||||
mfa_secret = deferred(Column(String(16), default=None))
|
||||
|
@ -152,17 +153,6 @@ class User(Base, Stndrd, Age_times):
|
|||
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def dramacoins(self):
|
||||
posts = sum([x[0] - 1 for x in
|
||||
g.db.query(Submission.score).options(lazyload('*')).filter_by(author_id=self.id, is_banned=False,
|
||||
deleted_utc=0).all()])
|
||||
comments = sum([x[0] - 1 for x in
|
||||
g.db.query(Comment.score).options(lazyload('*')).filter_by(author_id=self.id, is_banned=False,
|
||||
deleted_utc=0).all()])
|
||||
return int(posts + comments)
|
||||
|
||||
def has_block(self, target):
|
||||
|
||||
return g.db.query(UserBlock).filter_by(
|
||||
|
|
|
@ -24,6 +24,13 @@ import matplotlib.pyplot as plt
|
|||
from .front import frontlist
|
||||
from drama.__main__ import app, cache
|
||||
|
||||
@app.route("/dramacoins", methods=["GET"])
|
||||
@admin_level_required(6)
|
||||
def sex(v):
|
||||
for p in g.db.query(Submission).options(lazyload('*')).all() + g.db.query(Comment).options(lazyload('*')).all():
|
||||
p.author.dramacoins += p.upvotes + p.downvotes - 1
|
||||
g.db.add(p.author)
|
||||
return "sex"
|
||||
|
||||
@app.route("/admin/shadowbanned", methods=["GET"])
|
||||
@auth_required
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue