Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
actual-vt-capstone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danieljk
actual-vt-capstone
Commits
53430308
Unverified
Commit
53430308
authored
1 year ago
by
Matiss Janis Aboltins
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
(import) patch phantom transactions getting created (#2464)
parent
d7635755
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/loot-core/src/server/accounts/sync.ts
+40
-0
40 additions, 0 deletions
packages/loot-core/src/server/accounts/sync.ts
upcoming-release-notes/2464.md
+6
-0
6 additions, 0 deletions
upcoming-release-notes/2464.md
with
46 additions
and
0 deletions
packages/loot-core/src/server/accounts/sync.ts
+
40
−
0
View file @
53430308
...
...
@@ -482,6 +482,26 @@ export async function reconcileExternalTransactions(acctId, transactions) {
acctId
,
],
);
// Sort the matched transactions according to the distance from the original
// transactions date. i.e. if the original transaction is in 21-02-2024 and
// the matched transactions are: 20-02-2024, 21-02-2024, 29-02-2024 then
// the resulting data-set should be: 21-02-2024, 20-02-2024, 29-02-2024.
fuzzyDataset
=
fuzzyDataset
.
sort
((
a
,
b
)
=>
{
const
aDistance
=
Math
.
abs
(
dateFns
.
differenceInMilliseconds
(
dateFns
.
parseISO
(
trans
.
date
),
dateFns
.
parseISO
(
db
.
fromDateRepr
(
a
.
date
)),
),
);
const
bDistance
=
Math
.
abs
(
dateFns
.
differenceInMilliseconds
(
dateFns
.
parseISO
(
trans
.
date
),
dateFns
.
parseISO
(
db
.
fromDateRepr
(
b
.
date
)),
),
);
return
aDistance
>
bDistance
?
1
:
-
1
;
});
}
transactionsStep1
.
push
({
...
...
@@ -645,6 +665,26 @@ export async function reconcileTransactions(acctId, transactions) {
acctId
,
],
);
// Sort the matched transactions according to the distance from the original
// transactions date. i.e. if the original transaction is in 21-02-2024 and
// the matched transactions are: 20-02-2024, 21-02-2024, 29-02-2024 then
// the resulting data-set should be: 21-02-2024, 20-02-2024, 29-02-2024.
fuzzyDataset
=
fuzzyDataset
.
sort
((
a
,
b
)
=>
{
const
aDistance
=
Math
.
abs
(
dateFns
.
differenceInMilliseconds
(
dateFns
.
parseISO
(
trans
.
date
),
dateFns
.
parseISO
(
db
.
fromDateRepr
(
a
.
date
)),
),
);
const
bDistance
=
Math
.
abs
(
dateFns
.
differenceInMilliseconds
(
dateFns
.
parseISO
(
trans
.
date
),
dateFns
.
parseISO
(
db
.
fromDateRepr
(
b
.
date
)),
),
);
return
aDistance
>
bDistance
?
1
:
-
1
;
});
}
transactionsStep1
.
push
({
...
...
This diff is collapsed.
Click to expand it.
upcoming-release-notes/2464.md
0 → 100644
+
6
−
0
View file @
53430308
---
category
:
Bugfix
authors
:
[
MatissJanis
]
---
Fix csv/ofx import sometimes importing duplicate transactions
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment