diff --git a/Website/__init__.py b/Website/__init__.py index 5be458b..bba03dc 100644 --- a/Website/__init__.py +++ b/Website/__init__.py @@ -69,49 +69,51 @@ def create_app(test_config=None): def transactionlist(): db = get_db() c = db.cursor() - text = "" + action_list = [] c.execute("SELECT * FROM transaction_log ORDER BY ROWID DESC LIMIT 1000") transactionlist = c.fetchall() for i in transactionlist: - statement = i[0] - user_id = i[1] - before = i[2] - after = i[3] - change = i[4] - if statement == "balance": - reverse_statement = "balance" - reverse_user_id = user_id - reverse_before = None - reverse_after = None - reverse_change = change *(-1) - elif statement == "add_user": - reverse_statement = "remove_user" - reverse_user_id = user_id - reverse_before = after - reverse_after = None - reverse_change = None - elif statement == "remove_user": - reverse_statement = "add_user" - reverse_user_id = user_id - reverse_before = None - reverse_after = before - reverse_change = None - elif statement == "add_tag": - reverse_statement = "remove_tag" - reverse_user_id = user_id - reverse_before = after - reverse_after = None - reverse_change = None - elif statement == "remove_tag": - reverse_statement = "add_tag" - reverse_user_id = user_id - reverse_before = None - reverse_after = before - reverse_change = None + action = { + "statement":i[0], + "user_id":i[1], + "before":i[2], + "after":i[3], + "change":i[4] + } + if action["statement"] == "balance": + action["reverse_statement"] = "balance" + action["reverse_user_id"] = action["user_id"] + action["reverse_before"] = None + action["reverse_after"] = None + action["reverse_change"] = action["change"] *(-1) + elif action["statement"] == "add_user": + action["reverse_statement"] = "remove_user" + action["reverse_user_id"] = action["user_id"] + action["reverse_before"] = action["after"] + action["reverse_after"] = None + action["reverse_change"] = None + elif action["statement"] == "remove_user": + action["reverse_statement"] = "add_user" + action["reverse_user_id"] = action["user_id"] + action["reverse_before"] = None + action["reverse_after"] = action["before"] + action["reverse_change"] = None + elif action["statement"] == "add_tag": + action["reverse_statement"] = "remove_tag" + action["reverse_user_id"] = action["user_id"] + action["reverse_before"] = action["after"] + action["reverse_after"] = None + action["reverse_change"] = None + elif action["statement"] == "remove_tag": + action["reverse_statement"] = "add_tag" + action["reverse_user_id"] = action["user_id"] + action["reverse_before"] = None + action["reverse_after"] = action["before"] + action["reverse_change"] = None else: raise Exception(statement) - text = text + f'

{statement} userid:{user_id} {before} {after} {change}



' - return text + action_list.append(action) + return render_template("transactionlist.html", action_list=action_list) @app.route("/list/user", methods=['GET']) def user_info():