Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Lunchflow UI fixes (#384)

soky srm84f1e18a79b9
diff --git a/app/models/lunchflow_account.rb b/app/models/lunchflow_account.rb
index 01087450d2..d79daff70c 100644
--- a/app/models/lunchflow_account.rb
+++ b/app/models/lunchflow_account.rb
@@ -21,10 +21,17 @@ class LunchflowAccount < ApplicationRecord
# Map Lunchflow field names to our field names
# Lunchflow API returns: { id, name, institution_name, institution_logo, provider, currency, status }
+ # Build display name: "Institution Name - Account Name" if institution is present
+ display_name = if snapshot[:institution_name].present?
+ "#{snapshot[:institution_name]} - #{snapshot[:name]}"
+ else
+ snapshot[:name]
+ end
+
update!(
current_balance: nil, # Balance not provided by accounts endpoint
currency: parse_currency(snapshot[:currency]) || "USD",
- name: snapshot[:name],
+ name: display_name,
account_id: snapshot[:id].to_s,
account_status: snapshot[:status],
provider: snapshot[:provider],
diff --git a/app/models/lunchflow_entry/processor.rb b/app/models/lunchflow_entry/processor.rb
index 11a7801dd6..978528f280 100644
--- a/app/models/lunchflow_entry/processor.rb
+++ b/app/models/lunchflow_entry/processor.rb
@@ -25,7 +25,8 @@ class LunchflowEntry::Processor
date: date,
name: name,
source: "lunchflow",
- merchant: merchant
+ merchant: merchant,
+ notes: notes
)
rescue ArgumentError => e
# Re-raise validation errors (missing required fields, invalid data)
@@ -65,20 +66,11 @@ class LunchflowEntry::Processor
end
def name
- # Use Lunchflow's merchant and description to create informative transaction names
- merchant_name = data[:merchant]
- description = data[:description]
-
- # Combine merchant + description when both are present and different
- if merchant_name.present? && description.present? && merchant_name != description
- "#{merchant_name} - #{description}"
- elsif merchant_name.present?
- merchant_name
- elsif description.present?
- description
- else
- "Unknown transaction"
- end
+ data[:merchant].presence || "Unknown transaction"
+ end
+
+ def notes
+ data[:description].presence
end
def merchant
diff --git a/app/views/lunchflow_items/setup_accounts.html.erb b/app/views/lunchflow_items/setup_accounts.html.erb
index 63886fbe26..551292c7ea 100644
--- a/app/views/lunchflow_items/setup_accounts.html.erb
+++ b/app/views/lunchflow_items/setup_accounts.html.erb
@@ -56,13 +56,7 @@
<div>
<h3 class="font-medium text-primary">
<%= lunchflow_account.name %>
- <% if lunchflow_account.institution_metadata.present? && lunchflow_account.institution_metadata['name'].present? %>
- <span class="text-secondary">• <%= lunchflow_account.institution_metadata["name"] %></span>
- <% end %>
</h3>
- <p class="text-sm text-secondary">
- <%= t(".balance") %>: <%= number_to_currency(lunchflow_account.current_balance || 0, unit: lunchflow_account.currency) %>
- </p>
</div>
</div>