[Interactive] Adds new tag
This commit is contained in:
parent
fd24ac3318
commit
13709b7a04
@ -7,9 +7,12 @@ from pfbudget.utils.utils import parse_args_period
|
||||
|
||||
def interactive(manager: Manager):
|
||||
with manager.db.session() as session:
|
||||
|
||||
categories = session.get(type.Category)
|
||||
print(f"Available categories: {categories}")
|
||||
print(f"Available tags: {session.get(type.Tag)}")
|
||||
print(f"Available categories: {[c.name for c in categories]}")
|
||||
tags = session.get(type.Tag)
|
||||
print(f"Available tags: {[t.name for t in tags]}")
|
||||
|
||||
transactions = session.get(type.Transaction, ~type.Transaction.category.has())
|
||||
print(f"{len(transactions)} transactions left to categorize")
|
||||
|
||||
@ -25,6 +28,9 @@ def interactive(manager: Manager):
|
||||
|
||||
case "tag":
|
||||
tag = input("tag: ")
|
||||
if tag not in [t.name for t in tags]:
|
||||
session.add([type.Tag(tag)])
|
||||
|
||||
transaction.tags.add(type.TransactionTag(tag))
|
||||
|
||||
case "note":
|
||||
|
||||
@ -116,7 +116,14 @@ class Manager:
|
||||
banks = NordigenInput().country_banks(params[0])
|
||||
print(banks)
|
||||
|
||||
case Operation.BankAdd | Operation.CategoryAdd | Operation.NordigenAdd | Operation.RuleAdd | Operation.TagAdd | Operation.TagRuleAdd:
|
||||
case (
|
||||
Operation.BankAdd
|
||||
| Operation.CategoryAdd
|
||||
| Operation.NordigenAdd
|
||||
| Operation.RuleAdd
|
||||
| Operation.TagAdd
|
||||
| Operation.TagRuleAdd
|
||||
):
|
||||
with self.db.session() as session:
|
||||
session.add(params)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user