From 80dace59b385aa927a283fa653255e9ba464c193 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Wed, 23 Feb 2022 08:18:52 +1100 Subject: [PATCH] reconcile: Rename statement reconciler. --- ...rototype_amex_reconciler.py => statement_reconciler.py} | 7 +++++++ 1 file changed, 7 insertions(+) rename conservancy_beancount/reconcile/{prototype_amex_reconciler.py => statement_reconciler.py} (98%) diff --git a/conservancy_beancount/reconcile/prototype_amex_reconciler.py b/conservancy_beancount/reconcile/statement_reconciler.py similarity index 98% rename from conservancy_beancount/reconcile/prototype_amex_reconciler.py rename to conservancy_beancount/reconcile/statement_reconciler.py index 3d6cc87..a675e32 100644 --- a/conservancy_beancount/reconcile/prototype_amex_reconciler.py +++ b/conservancy_beancount/reconcile/statement_reconciler.py @@ -218,6 +218,8 @@ def records_match(r1: Dict, r2: Dict) -> Tuple[bool, str]: # We never consider payee if there's a check_id in the books. check_message = '' payee_message = '' + # Sometimes we get unrelated numbers in the statement column with check-ids, + # so we can't match based on the existence of a statement check-id. if r2['check_id']: payee_score = 0.0 if r1['check_id'] and r2['check_id'] and r1['check_id'] == r2['check_id']: @@ -255,6 +257,11 @@ def match_statement_and_books(statement_trans: list, books_trans: list): # items. books_trans = list(books_trans) + # We can delete the matched books trans, but seems not a good idea to delete + # while iterating through statement_trans. Instead pushing onto a separate + # list. + remaining_statement_trans = [] + for r1 in statement_trans: best_match_score = 0 best_match_index = None