Add original and additional comment columns do DB
To have cleared information on manually added transactions to the database, this patch adds the original column so those added after the parsing can be marked as such. Also adds a column to add comments to transaction, when they are not explicit from the transaction message.
This commit is contained in:
parent
865874f637
commit
a1f5699b12
@ -20,12 +20,14 @@ sqlite3.register_adapter(Decimal, lambda d: float(d))
|
||||
__DB_NAME = "data.db"
|
||||
|
||||
CREATE_TRANSACTIONS_TABLE = """
|
||||
CREATE TABLE IF NOT EXISTS transactions (
|
||||
date TEXT NOT NULL,
|
||||
description TEXT,
|
||||
bank TEXT,
|
||||
value REAL NOT NULL,
|
||||
category TEXT
|
||||
CREATE TABLE IF NOT EXISTS "transactions" (
|
||||
"date" TEXT NOT NULL,
|
||||
"description" TEXT,
|
||||
"bank" TEXT NOT NULL,
|
||||
"value" REAL NOT NULL,
|
||||
"category" TEXT,
|
||||
"original" TEXT,
|
||||
"additional comments" TEXT
|
||||
);
|
||||
"""
|
||||
|
||||
|
||||
@ -15,6 +15,8 @@ class Transaction:
|
||||
self.bank = ""
|
||||
self.value = 0
|
||||
self.category = None
|
||||
self.original = ""
|
||||
self.additional_comment = ""
|
||||
|
||||
arg = args[0] if len(args) == 1 else list(args)
|
||||
try:
|
||||
@ -29,6 +31,8 @@ class Transaction:
|
||||
else:
|
||||
self.value = Decimal(args[3])
|
||||
self.category = arg[4]
|
||||
self.original = arg[5]
|
||||
self.additional_comment = arg[6]
|
||||
except IndexError:
|
||||
pass
|
||||
except InvalidOperation:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user