-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
♻️ (bank-sync) unify the sync/reconciliation logic for internal & external sync #2534
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -575,6 +580,7 @@ export async function reconcileExternalTransactions(acctId, transactions) { | |||
|
|||
// Update the transaction | |||
const updates = { | |||
date: trans.date, |
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.
I think that it's fine to add this to the bank-sync transactions too. It will update the transaction date if it changes after the initial sync. But LMK if you think this is a bad idea. Worst case we can make this conditional.
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.
Also to note: this should be the only functional change. Everything else should be exactly the same as before.
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.
This would revert #1559, and personally I think it's a bad idea since it removes agency from the user to correct the dates. (I for example semi-regularly change the dates after shopping at places that batch-submit transactions multiple days after they occur (sometimes over a week >.>), because to me it matters more when I made the transaction than when my bank actually booked it.)
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.
That's an excellent point!
I've made this operation conditional: 0edcd09
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
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger 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 No assets were bigger Smaller
Unchanged No assets were unchanged |
But uh wait, is what you're calling 'internal' sync even used for anything? I see that it's what was the |
The original was used for both plaid, but also for csv/ofx imports. So these file imports are what I would call "internal". Good shout on Plaid. It's been over a year now without any activity on it, so I think it's finally time to remove it from the codebase (it doesn't work either way, so I don't think we're losing much there..). But that - in a separate PR. |
Ah, I'd missed that the CSV import ends up using the same reconciliation logic, makes sense of course. I still find it rather confusing to use internal/external for these, since there doesn't seem to be anything more internal or external about either. If anything it feels to me like CSV imports would be more external since you need to manually import them, rather than the application itself performing the import, heh. Either way I think this terminology is something that really needs to be documented. And well, there is certainly no such thing as a |
I feel like using For the reconciliation functions I have no real ideas for how to do it better right now, for the sync functions my only concrete suggestion was to not even bother doing it at all since one of them is literally never used, but on the other hand I just reviewed the changes in more detail and since they're pretty small and the work is already done it probably doesn't matter so why bother with more churn. In all, I think what you currently have looks good, and then we could maybe replace My one question is, does the new |
Ok, so a few updates:
I will follow up with another PR for the full Plaid removal later on. Don't want this PR to balloon even more than it already has. |
Looks good to me, though I still wonder about the defaulted function argument. :) |
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.
LGTM!
Unifying the reconciliation and syncing logic to reduce duplication.
Previously we had
reconcileTransactions
,reconcileExternalTransactions
,syncAccount
andsyncExternalAccount
. Now we have only one of each.The logic there is still not exactly clean. But at least now we have a single place for it instead of copy&paste duplication.