Add duplicate transaction detection on PDF upload#17
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
transaction_exists()method toTransactionRepositorythat checks for duplicates by matching on(date, amount, description)UploadDialog) so that re-uploading the same bank statement silently skips already-imported transactionsHow it works
When a user uploads a Bank of America PDF statement, each parsed transaction is checked against the database before insertion. If a transaction with the same date, amount, and description already exists, it is skipped via
continue. This prevents duplicate entries when the same statement is uploaded multiple times.API changes
TransactionRepository.transaction_exists(transaction: Transaction) -> bool(new)Checks whether a transaction with matching
date,amount, anddescriptionalready exists in the database. Category is intentionally excluded from the check since it may be updated after initial import.Design decisions
Test plan
test_transaction_exists_returns_true_for_duplicate-- exact match returnsTruetest_transaction_exists_returns_false_when_not_found-- empty DB returnsFalsetest_transaction_exists_different_date-- different date returnsFalsetest_transaction_exists_different_amount-- different amount returnsFalsetest_transaction_exists_different_description-- different description returnsFalse🤖 Generated with Claude Code