forked from bton/matekasse
log statements
This commit is contained in:
parent
657c500f24
commit
437a7e596c
2 changed files with 14 additions and 14 deletions
|
@ -84,26 +84,26 @@ def create_app(test_config=None):
|
||||||
reverse_before = None
|
reverse_before = None
|
||||||
reverse_after = None
|
reverse_after = None
|
||||||
reverse_change = change *(-1)
|
reverse_change = change *(-1)
|
||||||
elif statement == "adduser":
|
elif statement == "add_user":
|
||||||
reverse_statement = "removeuser"
|
reverse_statement = "remove_user"
|
||||||
reverse_user_id = user_id
|
reverse_user_id = user_id
|
||||||
reverse_before = after
|
reverse_before = after
|
||||||
reverse_after = None
|
reverse_after = None
|
||||||
reverse_change = None
|
reverse_change = None
|
||||||
elif statement == "removeuser":
|
elif statement == "remove_user":
|
||||||
reverse_statement = "adduser"
|
reverse_statement = "add_user"
|
||||||
reverse_user_id = user_id
|
reverse_user_id = user_id
|
||||||
reverse_before = None
|
reverse_before = None
|
||||||
reverse_after = before
|
reverse_after = before
|
||||||
reverse_change = None
|
reverse_change = None
|
||||||
elif statement == "addtag":
|
elif statement == "add_tag":
|
||||||
reverse_statement = "removetag"
|
reverse_statement = "remove_tag"
|
||||||
reverse_user_id = user_id
|
reverse_user_id = user_id
|
||||||
reverse_before = after
|
reverse_before = after
|
||||||
reverse_after = None
|
reverse_after = None
|
||||||
reverse_change = None
|
reverse_change = None
|
||||||
elif statement == "removetag":
|
elif statement == "remove_tag":
|
||||||
reverse_statement = "addtag"
|
reverse_statement = "add_tag"
|
||||||
reverse_user_id = user_id
|
reverse_user_id = user_id
|
||||||
reverse_before = None
|
reverse_before = None
|
||||||
reverse_after = beforeaddtag
|
reverse_after = beforeaddtag
|
||||||
|
@ -381,13 +381,13 @@ def create_app(test_config=None):
|
||||||
after = request.form["after"]
|
after = request.form["after"]
|
||||||
change = request.form["change"]
|
change = request.form["change"]
|
||||||
|
|
||||||
if statement == "adduser":
|
if statement == "add_user":
|
||||||
db_handler.add_user(after)
|
db_handler.add_user(after)
|
||||||
elif statement == "removeuser":
|
elif statement == "remove_user":
|
||||||
db_handler.remove_user(user_id)
|
db_handler.remove_user(user_id)
|
||||||
elif statement == "addtag":
|
elif statement == "add_tag":
|
||||||
db_handler.add_tag(user_id, after)
|
db_handler.add_tag(user_id, after)
|
||||||
elif statement == "removetag":
|
elif statement == "remove_tag":
|
||||||
db_handler.remove_tag(befor)
|
db_handler.remove_tag(befor)
|
||||||
elif statement == "balance":
|
elif statement == "balance":
|
||||||
db_handler.change_balance(user_id, change)
|
db_handler.change_balance(user_id, change)
|
||||||
|
|
|
@ -36,7 +36,7 @@ def add_tag(user_id, tag_id):
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
c.execute("INSERT OR IGNORE INTO tags (tagid, userid) VALUES ?, ?)", [tag_id, user_id])
|
c.execute("INSERT OR IGNORE INTO tags (tagid, userid) VALUES ?, ?)", [tag_id, user_id])
|
||||||
db.commit()
|
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):
|
def remove_tag(tag_id):
|
||||||
db = get_db()
|
db = get_db()
|
||||||
|
@ -44,7 +44,7 @@ def remove_tag(tag_id):
|
||||||
c.execute("SELECT * FROM tags WHERE tagid = ?", [tag_id])
|
c.execute("SELECT * FROM tags WHERE tagid = ?", [tag_id])
|
||||||
user_id = c.fetchone()[1]
|
user_id = c.fetchone()[1]
|
||||||
c.execute("DELETE FROM tags WHERE tagid = ?", [tag_id])
|
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()
|
db.commit()
|
||||||
|
|
||||||
def change_balance(user_id, change):
|
def change_balance(user_id, change):
|
||||||
|
|
Loading…
Reference in a new issue