reconcile: Quote metadata, fix hiding of matched + reconciled lines.

This commit is contained in:
Ben Sturmfels 2022-02-24 20:58:04 +11:00
parent 7c5e98c588
commit 72385fd0bd
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0

View file

@ -294,7 +294,7 @@ def format_matches(matches, csv_statement: str, show_reconciled_matches):
note = ', '.join(note) note = ', '.join(note)
note = ': ' + note if note else note note = ': ' + note if note else note
if r1s and r2s: if r1s and r2s:
if show_reconciled_matches and all(x['bank_statement'] for x in r2s): if show_reconciled_matches or not all(x['bank_statement'] for x in r2s):
if len(r2s) == 1: if len(r2s) == 1:
match_output.append([r1s[0]['date'], f'{format_record(r1s[0])}{format_record(r2s[0])} ✓ Matched{note}']) match_output.append([r1s[0]['date'], f'{format_record(r1s[0])}{format_record(r2s[0])} ✓ Matched{note}'])
else: else:
@ -322,8 +322,8 @@ def metadata_for_match(match, statement_filename, csv_filename):
for books_entry in books_entries: for books_entry in books_entries:
for statement_entry in statement_entries: for statement_entry in statement_entries:
if not books_entry['bank_statement']: if not books_entry['bank_statement']:
metadata.append((books_entry['filename'], books_entry['line'], f' bank-statement: {statement_filename}')) metadata.append((books_entry['filename'], books_entry['line'], f' bank-statement: "{statement_filename}"'))
metadata.append((books_entry['filename'], books_entry['line'], f' bank-statement-csv: {csv_filename}:{statement_entry["line"]}')) metadata.append((books_entry['filename'], books_entry['line'], f' bank-statement-csv: "{csv_filename}:{statement_entry["line"]}"'))
return metadata return metadata