diff --git a/helper.py b/helper.py index 0a039bc..28c3f0f 100644 --- a/helper.py +++ b/helper.py @@ -42,10 +42,12 @@ def check_single_profile(): print("--profile is required when you have more than one database.") sys.exit(1) + def list_profiles(): files = os.listdir(f"{DATA_DIR}/databases") return [x.split(".")[0] for x in files] + def get_session(profile_name): if not profile_name: profile_name = check_single_profile() diff --git a/info.py b/info.py index 2695832..90eb519 100644 --- a/info.py +++ b/info.py @@ -5,6 +5,7 @@ from helper import get_session, list_profiles, build_database_filename, build_ru import sys import click + @click.command(name="info") def command(): for profile in list_profiles(): @@ -19,7 +20,7 @@ def command(): unsorted = session.query(Transaction).filter(Transaction.category_id == None).count() transactions = session.query(Transaction).count() categories = session.query(Category).count() - unsorted_percent = round(unsorted / (transactions/100), 1) + unsorted_percent = round(unsorted / (transactions / 100), 1) print(f"Transactions: {transactions}") print(f" Unsorted: {unsorted} ({unsorted_percent}%)") diff --git a/validate.py b/validate.py index 1ecb566..2e13d94 100644 --- a/validate.py +++ b/validate.py @@ -16,7 +16,6 @@ except ImportError: from yaml import Loader, Dumper - @click.command(name="validate") def command(): for profile in list_profiles(): @@ -24,7 +23,6 @@ def command(): db_path = build_database_filename(profile) rules_path = build_rules_filename(profile) - # Rules if os.path.exists(rules_path) and os.path.isfile(rules_path): with open(rules_path) as fh: