Added link to the list and changet int positiv if removed

This commit is contained in:
2000-Trek 2023-06-09 19:47:04 +02:00
parent 6f2504059e
commit 51f3d5a4d7

View file

@ -72,6 +72,7 @@ def change():
return '<p>Pleas enter a number!</p><a href="/list">tags and user list</a>' return '<p>Pleas enter a number!</p><a href="/list">tags and user list</a>'
if change < 0: if change < 0:
text = "removed from" text = "removed from"
change = change * -1
elif change > 0: elif change > 0:
text = "added to" text = "added to"
elif change == 0: elif change == 0:
@ -79,7 +80,7 @@ def change():
c.execute(f"UPDATE users SET balance = balance + {change} WHERE id={user_id}") c.execute(f"UPDATE users SET balance = balance + {change} WHERE id={user_id}")
c.execute(f"SELECT * FROM users WHERE id={user_id}") c.execute(f"SELECT * FROM users WHERE id={user_id}")
user = c.fetchall()[0][1] user = c.fetchall()[0][1]
return f'<p>{change} was {text} {user}' return f'<p>{change} was {text} {user}</p> <a href="/list">back to the list></a>'
@app.route("/addtag", methods=['GET']) @app.route("/addtag", methods=['GET'])
def get_addtag_request(): def get_addtag_request():