Skip to content

Commit

Permalink
fix(import): set amount to zero when error on parsing csv amount
Browse files Browse the repository at this point in the history
  • Loading branch information
howeyc committed Mar 7, 2022
1 parent 4869ab0 commit b69d765
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ledger/cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ var importCmd = &cobra.Command{
expenseAccount.Name = string(classifier.Classes[likely])
}

// Parse error, set to zero
if _, bset := expenseAccount.Balance.SetString(record[amountColumn]); !bset {
expenseAccount.Balance.SetFloat64(0)
}

// Negate amount if required
expenseAccount.Balance.SetString(record[amountColumn])
if negateAmount {
expenseAccount.Balance.Neg(expenseAccount.Balance)
}
Expand Down

0 comments on commit b69d765

Please sign in to comment.