From dd9e3463c94dff6efc0fc36b26dda53940506567 Mon Sep 17 00:00:00 2001 From: bton Date: Tue, 19 Mar 2024 23:52:49 +0100 Subject: [PATCH] Transaction log without time --- Website/__init__.py | 12 ++++++------ Website/db.py | 2 +- Website/schema.sql | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Website/__init__.py b/Website/__init__.py index 12f1742..05a6555 100644 --- a/Website/__init__.py +++ b/Website/__init__.py @@ -73,11 +73,11 @@ def create_app(test_config=None): c.execute("SELECT * FROM transaction_log ORDER BY ROWID DESC LIMIT 1000") transactionlist = c.fetchall() for i in transactionlist: - statement = i[1] - user_id = i[2] - before = i[3] - after = i[4] - change = i[5] + 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 @@ -110,7 +110,7 @@ def create_app(test_config=None): reverse_change = None else: raise Exception(statement) - text = text + f'

{i[0]} {statement} userid:{user_id} {before} {after} {change}



' + text = text + f'

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



' return text @app.route("/list/user", methods=['GET']) diff --git a/Website/db.py b/Website/db.py index 6ffa340..c0fedc0 100644 --- a/Website/db.py +++ b/Website/db.py @@ -8,7 +8,7 @@ from flask import current_app, g def log(statement, user_id=None, before=None, after=None, change=None): db = get_db() c = db.cursor() - c.execute("INSERT INTO transaction_log (timestamp, type, user_id, before, after, change) VALUES (?, ?, ?, ?, ?, ?)", [datetime.now(), statement, user_id, before, after, change]) + c.execute("INSERT INTO transaction_log (type, user_id, before, after, change) VALUES (?, ?, ?, ?, ?)", [ statement, user_id, before, after, change]) db.commit() def add_user(after): diff --git a/Website/schema.sql b/Website/schema.sql index 70f454e..ed0bd96 100644 --- a/Website/schema.sql +++ b/Website/schema.sql @@ -12,7 +12,6 @@ CREATE TABLE IF NOT EXISTS "tags" ( PRIMARY KEY("tagid") ); CREATE TABLE IF NOT EXISTS "transaction_log" ( - "timestamp" INTEGER NOT NULL, "type" TEXT NOT NULL, "user_id" INTEGER, "before" TEXT,