mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-11-19 07:08:54 +01:00
QIF imports deduplicate each transaction by storing a SHA-256 of its raw lines as the transaction's internal_id and skipping rows whose hash is already taken. The hash didn't include the account, which broke two cases: - Importing the same file into two accounts (possible since the account can be picked per run) skipped every row of the second import. - Two real transactions with the same date, amount and payee in one file hashed to the same ID, so the second one was always dropped. The internal ID now hashes the account's ID and the transaction's occurrence (how many identical transactions came before it in the file) together with the raw lines. Using the occurrence instead of the position in the file keeps the IDs stable when a later export of the same statement has more transactions before or between the repeated ones. Transactions imported before this change keep their old IDs. So that re-importing an old file doesn't duplicate them, the first occurrence of a transaction is also matched against the previous hash, limited to the account being imported into. Repeats of identical transactions, which the old hash always skipped, are imported now. The duplicate check also looks at soft-deleted transactions, like the CSV/Excel deduplication does. internal_id is unique, so a soft-deleted transaction with the same ID used to fail the import with an integrity error instead of being skipped. Fixes #671