Skip to content

Commit ffc29a3

Browse files
authored
fix: ignore transactions with amount of 0 on import (#827)
1 parent 2657f28 commit ffc29a3

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed

pkg/importer/parser/ynab-import/parse.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ func Parse(f io.Reader, account models.Account) ([]importer.TransactionPreview,
8787
t.Transaction.Amount = amount
8888
}
8989

90+
// Ignore transactions that have an amount of 0
9091
if t.Transaction.Amount.IsZero() {
91-
return csvReadError(reader, errors.New("the amount for a transaction must not be 0"))
92+
continue
9293
}
9394

9495
transactions = append(transactions, t)

pkg/importer/parser/ynab-import/parse_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func TestErrors(t *testing.T) {
6565
{"error-decimal-inflow.csv", "error in line 4 of the CSV: inflow could not be parsed to a decimal"},
6666
{"error-decimal-outflow.csv", "error in line 2 of the CSV: outflow could not be parsed to a decimal"},
6767
{"error-missing-amount.csv", "error in line 3 of the CSV: no amount is set for the transaction"},
68-
{"error-amount-zero.csv", "error in line 4 of the CSV: the amount for a transaction must not be 0"},
6968
{"error-outflow-and-inflow.csv", "error in line 2 of the CSV: both outflow and inflow are set for the transaction"},
7069
}
7170

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Category,Payee,Date,Inflow,Outflow
22
,exampleIssuer,11/06/2023,,82.8
3+
,Someone Sending 0 money,11/10/2023,,0

testdata/importer/ynab-import/error-amount-zero.csv

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)