1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-03 04:25:21 +02:00

Fix import crash with empty transaction name (#783)

This commit is contained in:
Jakub Kottnauer 2024-05-20 23:21:40 +02:00 committed by GitHub
parent 444155c103
commit 32748b0632
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -112,7 +112,7 @@ class Import < ApplicationRecord
csv.table.each do |row|
category = account.family.transaction_categories.find_or_initialize_by(name: row["category"])
txn = account.transactions.build \
name: row["name"] || "Imported transaction",
name: row["name"].presence || "Imported transaction",
date: Date.iso8601(row["date"]),
category: category,
amount: BigDecimal(row["amount"]) * -1, # User inputs amounts with opposite signage of our internal representation