1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Add tag preview when importing (#800)

This commit is contained in:
Jakub Kottnauer 2024-05-24 16:39:24 +02:00 committed by GitHub
parent 457247da8e
commit 6e59fdb369
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -122,7 +122,7 @@ class Import < ApplicationRecord
tags << tag_cache[tag_string] ||= account.family.tags.find_or_initialize_by(name: tag_string)
end
category = category_cache[category_name] ||= account.family.transaction_categories.find_or_initialize_by(name: category_name)
category = category_cache[category_name] ||= account.family.transaction_categories.find_or_initialize_by(name: category_name) if category_name.present?
txn = account.transactions.build \
name: row["name"].presence || FALLBACK_TRANSACTION_NAME,

View file

@ -6,6 +6,12 @@
<%= render partial: "transactions/categories/badge", locals: { category: transaction.category } %>
</div>
<div class="w-48 flex gap-1">
<% transaction.tags.each do |tag| %>
<%= render partial: "tags/badge", locals: { tag: tag } %>
<% end %>
</div>
<div class="ml-auto">
<%= content_tag :p, format_money(Money.new(-transaction.amount, @import.account.currency)), class: ["whitespace-nowrap", BigDecimal(transaction.amount).negative? ? "text-green-600" : "text-red-600"] %>
</div>