@@ -44,13 +44,11 @@ func Parse(f io.Reader, account models.Account) ([]importer.TransactionPreview,
4444 }
4545
4646 t := importer.TransactionPreview {
47- Model : models.Transaction {
48- TransactionCreate : models.TransactionCreate {
49- Date : date ,
50- ImportHash : helpers .Sha256String (strings .Join (record , "," )),
51- Note : record [Memo ],
52- BudgetID : account .BudgetID ,
53- },
47+ Transaction : models.TransactionCreate {
48+ Date : date ,
49+ ImportHash : helpers .Sha256String (strings .Join (record , "," )),
50+ Note : record [Memo ],
51+ BudgetID : account .BudgetID ,
5452 },
5553 }
5654
@@ -60,28 +58,28 @@ func Parse(f io.Reader, account models.Account) ([]importer.TransactionPreview,
6058 } else if record [Outflow ] == "" && record [Inflow ] == "" {
6159 return csvReadError (reader , errors .New ("no amount is set for the transaction" ))
6260 } else if record [Outflow ] != "" {
63- t .Model . TransactionCreate .SourceAccountID = account .DefaultModel .ID
61+ t .Transaction .SourceAccountID = account .DefaultModel .ID
6462 t .DestinationAccountName = record [Payee ]
6563
6664 amount , err := decimal .NewFromString (record [Outflow ])
6765 if err != nil {
6866 return csvReadError (reader , errors .New ("outflow could not be parsed to a decimal" ))
6967 }
7068
71- t .Model . TransactionCreate . Amount = amount . Neg ()
69+ t .Transaction . Amount = amount
7270 } else {
73- t .Model . TransactionCreate .DestinationAccountID = account .DefaultModel .ID
71+ t .Transaction .DestinationAccountID = account .DefaultModel .ID
7472 t .SourceAccountName = record [Payee ]
7573
7674 amount , err := decimal .NewFromString (record [Inflow ])
7775 if err != nil {
7876 return csvReadError (reader , errors .New ("inflow could not be parsed to a decimal" ))
7977 }
8078
81- t .Model . TransactionCreate .Amount = amount
79+ t .Transaction .Amount = amount
8280 }
8381
84- if t .Model . TransactionCreate .Amount .IsZero () {
82+ if t .Transaction .Amount .IsZero () {
8583 return csvReadError (reader , errors .New ("the amount for a transaction must not be 0" ))
8684 }
8785
0 commit comments