diff --git a/main.py b/main.py index 44fb6ef..c3cba4a 100644 --- a/main.py +++ b/main.py @@ -117,6 +117,7 @@ def remove_user(): return f'
Deleted user {user_name}
return to the tags and user list' else: return "Error: 043" + @app.route("/adduser/user", methods=['GET']) def adduser(): user = request.args.get("username") @@ -132,34 +133,25 @@ def adduser(): @app.route("/change", methods=['GET']) def change(): - user_id = int(request.args.get("id")) try: + user_id = int(request.args.get("id")) change = int(request.args.get("change")) except ValueError: return 'Error: 095
tags and user list' - c.execute(f"UPDATE users SET balance = balance + {change} WHERE id={user_id}") - socketio.emit("update", "update") - return """ - - - - """ - #socketio.emit("update", "update") - #conn.commit() - #if change < 0: - # text = "removed from" - # change_text = change * -1 - #elif change > 0: - # text = "added to" - # change_text = change - #elif change == 0: - # return "Nothing was done!
" - #c.execute(f"SELECT * FROM users WHERE id={user_id}") - #user = c.fetchall()[0][1] - #return f'{change_text} was {text} {user}
back to the list' - + c.execute(f"SELCET * FROM users WHERE id={user_id}") + if c.fetchall != []: + c.execute(f"UPDATE users SET balance = balance + {change} WHERE id={user_id}") + socketio.emit("update", "update") + return """ + + + + """ + else: + return "Error: 043" + @app.route("/addtag", methods=['GET']) def get_addtag_request(): global users