forked from MarseyWorld/MarseyWorld
sdfsdf
parent
3db5575319
commit
d45e55676c
|
@ -32,7 +32,7 @@ def grassed(v):
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}grassed.html", v=v, users=users)
|
return render_template(f"{template}grassed.html", v=v, users=users)
|
||||||
|
|
||||||
@app.get("/distribute/<comment>")
|
@app.post("/distribute/<comment>")
|
||||||
@limiter.limit("1/second")
|
@limiter.limit("1/second")
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
def distribute(v, comment):
|
def distribute(v, comment):
|
||||||
|
@ -55,7 +55,7 @@ def distribute(v, comment):
|
||||||
|
|
||||||
autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).first()
|
autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).first()
|
||||||
autobetter.coins -= pool
|
autobetter.coins -= pool
|
||||||
if autobetter.coins < 0: abort(400)
|
if autobetter.coins < 0: return {"error": "Not enough coins in bool"}
|
||||||
g.db.add(autobetter)
|
g.db.add(autobetter)
|
||||||
|
|
||||||
cid = notif_comment(f"You lost the 200 coins you bet on [{post.permalink}]({post.permalink}) :marseylaugh:")
|
cid = notif_comment(f"You lost the 200 coins you bet on [{post.permalink}]({post.permalink}) :marseylaugh:")
|
||||||
|
@ -65,7 +65,7 @@ def distribute(v, comment):
|
||||||
for vote in votes: add_notif(cid, vote.user.id)
|
for vote in votes: add_notif(cid, vote.user.id)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return f"Each winner has received {coinsperperson} coins!"
|
return {"message": f"Each winner has received {coinsperperson} coins!"}
|
||||||
|
|
||||||
@app.post("/@<username>/revert_actions")
|
@app.post("/@<username>/revert_actions")
|
||||||
@limiter.limit("1/second")
|
@limiter.limit("1/second")
|
||||||
|
|
|
@ -428,9 +428,12 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for c in p.bet_options %}
|
{% for c in p.bet_options %}
|
||||||
<div class="custom-control">
|
<div class="custom-control mt-3">
|
||||||
<input {% if c.poll_voted(v) %}checked{% endif %} class="custom-control-input bet" {% if not (v and v.coins > 200) or p.total_bet_voted(v) %}disabled{% endif %} type="radio" id="{{c.id}}" onchange="bet_vote('{{c.id}}')">
|
<input {% if c.poll_voted(v) %}checked{% endif %} class="custom-control-input bet" {% if not (v and v.coins > 200) or p.total_bet_voted(v) %}disabled{% endif %} type="radio" id="{{c.id}}" onchange="bet_vote('{{c.id}}')">
|
||||||
<label class="custom-control-label" for="{{c.id}}">{{c.body_html | safe}} - <a href="/votes?link=t3_{{c.id}}"><span id="bet-{{c.id}}">{{c.upvotes}}</span> bets</a>{% if not p.total_bet_voted(v) %}<span class="cost"> (cost of entry: 200 coins)</span>{% endif %}</label>
|
<label class="custom-control-label" for="{{c.id}}">{{c.body_html | safe}} - <a href="/votes?link=t3_{{c.id}}"><span id="bet-{{c.id}}">{{c.upvotes}}</span> bets</a>{% if not p.total_bet_voted(v) %}<span class="cost"> (cost of entry: 200 coins)</span>{% endif %}</label>
|
||||||
|
{% if v and v.admin_level > 2 %}
|
||||||
|
<button class="btn btn-primary px-2 mx-2" style="font-size:10px;padding:2px;margin-top:-5px" onclick="post_toast('/distribute/{{c.id}}')">Declare winner</button>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue