Fix import crash with empty transaction name (#783)

This commit was merged in pull request #783.
This commit is contained in:
Jakub Kottnauer
2024-05-20 23:21:40 +02:00
committed by GitHub
parent 444155c103
commit 32748b0632

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