sfdfsd
This commit is contained in:
parent
56c0fe2f9e
commit
8c13a0c879
2 changed files with 17 additions and 1 deletions
|
@ -56,7 +56,7 @@ class CommentVote(Base):
|
||||||
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
||||||
real = Column(Boolean, default=True)
|
real = Column(Boolean, default=True)
|
||||||
|
|
||||||
user = relationship("User", lazy="subquery", viewonly=True)
|
user = relationship("User", lazy="subquery")
|
||||||
comment = relationship("Comment", lazy="subquery", viewonly=True)
|
comment = relationship("Comment", lazy="subquery", viewonly=True)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
|
@ -21,6 +21,22 @@ SITE_NAME = environ.get("SITE_NAME", "").strip()
|
||||||
if SITE_NAME == 'PCM': cc = "splash mountain"
|
if SITE_NAME == 'PCM': cc = "splash mountain"
|
||||||
else: cc = "country club"
|
else: cc = "country club"
|
||||||
|
|
||||||
|
@app.get("/distribute/<cid>")
|
||||||
|
@admin_level_required(2)
|
||||||
|
def distribute(v, cid):
|
||||||
|
votes = g.db.query(CommentVote).filter_by(comment_id=cid)
|
||||||
|
autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).first()
|
||||||
|
coinsperperson = int(autobetter.coins / votes.count())
|
||||||
|
for vote in votes:
|
||||||
|
u = vote.user
|
||||||
|
u.coins += coinsperperson
|
||||||
|
g.db.add(u)
|
||||||
|
|
||||||
|
autobetter.coins = 0
|
||||||
|
g.db.add(autobetter)
|
||||||
|
g.db.commit()
|
||||||
|
return str(coinsperperson)
|
||||||
|
|
||||||
@app.get("/marseys")
|
@app.get("/marseys")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def marseys(v):
|
def marseys(v):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue