-
-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(#2562): Prevent transaction deduplication for imported transactions #2770
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged No assets were unchanged |
From my interpretation @strazto is implying that if the imported transaction doesn't have an The PR #2618 excludes all existing transactions with an I'm not super confident in what is technically correct here as you've mentioned some complex scenarios in comments in #2618, I'll let you be the judge @MatissJanis I believe the test case that would pass in this PR but not in #2618 would be something like the below. I have tested this test fails in #2618 as the assertion for the number of transactions fails, receiving 2, when expecting 1. test(
'given an imported tx with no imported_id, ' +
'when an existing transaction that has an imported_id and matches amount and is within 7 days of imported tx,' +
'then imported tx should reconcile with existing transaction from fuzzy match',
async () => {
const { id } = await prepareDatabase();
let payees = await getAllPayees();
expect(payees.length).toBe(0);
const existingTx = {
date: '2024-04-05',
amount: -1239,
imported_payee: 'Acme Inc.',
payee_name: 'Acme Inc.',
imported_id: 'b85cdd57-5a1c-4ca5-bd54-12e5b56fa02c',
notes: 'TEST TRANSACTION',
cleared: true,
};
// Add transaction to represent existing transaction with imoprted_id
await reconcileTransactions(id, [existingTx]);
payees = await getAllPayees();
expect(payees.length).toBe(1);
let transactions = await getAllTransactions();
expect(transactions.length).toBe(1);
// Import transaction similar to existing but with different date and no imported_id
await reconcileTransactions(id, [
{
...existingTx,
date: '2024-04-06',
imported_id: null,
}
]);
payees = await getAllPayees();
expect(payees.length).toBe(1);
transactions = await getAllTransactions();
expect(transactions.length).toBe(1);
expect(
transactions.find(
t => t.imported_id === 'b85cdd57-5a1c-4ca5-bd54-12e5b56fa02c',
).amount,
).toBe(-1239);
},
); Edit: After making this comment I went and got this PR on my machine. The test needed a bit of tweaking to work but in essence asserted my thinking was correct. I did find an issue/side effect, where if you merge a transaction that doesn't have an |
@pmoon00 nailed it, thanks for the test case, didn't have time to touch it this weekend :) I'll put it in the PR, can add you to the author list in the release note
That sounds like a bug, probably the Worth raising in its own ticket :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this seems to work as expected. Seeing no problems and the extra test case works as expected (fails in master
and in the previous PR, but passes here).
LGTM on my end, but I'd like another maintainer to review this too since it touches such an important part of the codebase.
Resolves #2562
Based on #2618 , with comments by @MatissJanis and others applied