feat: persist review workbench decisions (#1)
Merge dcy-012 / REQ-020 / BAT-016 implementation after green CI.
This commit is contained in:
@@ -10,6 +10,7 @@ from .shared import (
|
||||
re,
|
||||
row_to_dict,
|
||||
)
|
||||
from .review_decision_service import attach_review_decisions
|
||||
|
||||
def _rule_matches(rule: dict[str, Any], tx: dict[str, Any]) -> bool:
|
||||
if rule.get("transaction_type") and rule.get("transaction_type") != tx.get("type", ""):
|
||||
@@ -171,6 +172,8 @@ def get_uncategorized_workbench(
|
||||
group["recommendation"] = rec
|
||||
|
||||
group_items = sorted(groups.values(), key=lambda g: (int(g["count"]), int(g["total_amount"])), reverse=True)
|
||||
with db(db_path) as conn:
|
||||
txs = attach_review_decisions(conn, txs, "uncategorized_transaction", "id")
|
||||
recommendable_count = sum(1 for tx in txs if tx.get("recommended_category"))
|
||||
repeated_group_count = sum(1 for g in group_items if int(g.get("count") or 0) >= 2)
|
||||
total = row_to_dict(total_row) if total_row else {"count": 0, "total_amount": 0, "merchant_group_count": 0}
|
||||
|
||||
Reference in New Issue
Block a user