shorter param and variable

master
Aevann 2024-04-16 16:13:43 +02:00
parent 313ed57923
commit 8a9a2c2b46
2 changed files with 6 additions and 6 deletions

View File

@ -183,7 +183,7 @@ function giveaward(t) {
"kind": kind, "kind": kind,
"note": document.getElementById(note_id).value, "note": document.getElementById(note_id).value,
"emoji_behavior": document.getElementById("emoji_behavior").value, "emoji_behavior": document.getElementById("emoji_behavior").value,
"award_quantity": document.getElementById("award_quantity").value, "quantity": document.getElementById("award_quantity").value,
}, },
() => { () => {
let owned = document.getElementById(`${kind}-owned`) let owned = document.getElementById(`${kind}-owned`)

View File

@ -180,11 +180,11 @@ def award_thing(v, thing_type, id):
if obj.is_longpost and kind in {"ectoplasm", "candycorn", "candycane", "stab", "glowie", "tilt", "queen", "chud", "marsify", "Furry", "Edgy", "Femboy", "Furry Founder", "Edgy Founder", "Femboy Founder"}: if obj.is_longpost and kind in {"ectoplasm", "candycorn", "candycane", "stab", "glowie", "tilt", "queen", "chud", "marsify", "Furry", "Edgy", "Femboy", "Furry Founder", "Edgy Founder", "Femboy Founder"}:
abort(403, f'Long posts are protected from the {award_title} award!') abort(403, f'Long posts are protected from the {award_title} award!')
award_quantity = int(request.values.get("award_quantity", "1").strip() or 1) quantity = int(request.values.get("quantity", "1").strip() or 1)
if award_quantity < 1 or award_quantity > 7: if quantity < 1 or quantity > 7:
award_quantity = 1 quantity = 1
for x in range(award_quantity): for x in range(quantity):
g.db.flush() g.db.flush()
award = g.db.query(AwardRelationship).filter( award = g.db.query(AwardRelationship).filter(
AwardRelationship.kind == kind, AwardRelationship.kind == kind,
@ -671,7 +671,7 @@ def award_thing(v, thing_type, id):
if emoji_behavior == "horizontal": if emoji_behavior == "horizontal":
award.kind = "emoji-hz" award.kind = "emoji-hz"
plural = '' if award_quantity == 1 else 's' plural = '' if quantity == 1 else 's'
return {"message": f"{award_title} award{plural} given to {thing_type} successfully!"} return {"message": f"{award_title} award{plural} given to {thing_type} successfully!"}
@app.post("/trick_or_treat") @app.post("/trick_or_treat")