1
0
Fork 0
forked from bton/matekasse

log statements

This commit is contained in:
bton 2024-03-13 20:50:34 +01:00
parent 657c500f24
commit 437a7e596c
2 changed files with 14 additions and 14 deletions

View file

@ -84,26 +84,26 @@ def create_app(test_config=None):
reverse_before = None
reverse_after = None
reverse_change = change *(-1)
elif statement == "adduser":
reverse_statement = "removeuser"
elif statement == "add_user":
reverse_statement = "remove_user"
reverse_user_id = user_id
reverse_before = after
reverse_after = None
reverse_change = None
elif statement == "removeuser":
reverse_statement = "adduser"
elif statement == "remove_user":
reverse_statement = "add_user"
reverse_user_id = user_id
reverse_before = None
reverse_after = before
reverse_change = None
elif statement == "addtag":
reverse_statement = "removetag"
elif statement == "add_tag":
reverse_statement = "remove_tag"
reverse_user_id = user_id
reverse_before = after
reverse_after = None
reverse_change = None
elif statement == "removetag":
reverse_statement = "addtag"
elif statement == "remove_tag":
reverse_statement = "add_tag"
reverse_user_id = user_id
reverse_before = None
reverse_after = beforeaddtag
@ -381,13 +381,13 @@ def create_app(test_config=None):
after = request.form["after"]
change = request.form["change"]
if statement == "adduser":
if statement == "add_user":
db_handler.add_user(after)
elif statement == "removeuser":
elif statement == "remove_user":
db_handler.remove_user(user_id)
elif statement == "addtag":
elif statement == "add_tag":
db_handler.add_tag(user_id, after)
elif statement == "removetag":
elif statement == "remove_tag":
db_handler.remove_tag(befor)
elif statement == "balance":
db_handler.change_balance(user_id, change)

View file

@ -36,7 +36,7 @@ def add_tag(user_id, tag_id):
c = db.cursor()
c.execute("INSERT OR IGNORE INTO tags (tagid, userid) VALUES ?, ?)", [tag_id, user_id])
db.commit()
log("addtag", after=tag_id, user_id=user_id)
log("add_tag", after=tag_id, user_id=user_id)
def remove_tag(tag_id):
db = get_db()
@ -44,7 +44,7 @@ def remove_tag(tag_id):
c.execute("SELECT * FROM tags WHERE tagid = ?", [tag_id])
user_id = c.fetchone()[1]
c.execute("DELETE FROM tags WHERE tagid = ?", [tag_id])
log("removetag", before=tag_id, user_id=user_id)
log("remove_tag", before=tag_id, user_id=user_id)
db.commit()
def change_balance(user_id, change):