Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Fix for transaction drawer securities missing prices

Josh Pigfordd4bfcfb6f478
diff --git a/app/views/account/trades/show.html.erb b/app/views/account/trades/show.html.erb
index 7293f731..0f07e9ad 100644
--- a/app/views/account/trades/show.html.erb
+++ b/app/views/account/trades/show.html.erb
@@ -41,12 +41,14 @@
</div>
<% end %>
- <div class="flex items-center justify-between text-sm">
- <dt class="text-gray-500"><%= t(".current_market_price_label") %></dt>
- <dd class="text-gray-900"><%= format_money trade.security.current_price %></dd>
- </div>
+ <% if trade.security.current_price.present? %>
+ <div class="flex items-center justify-between text-sm">
+ <dt class="text-gray-500"><%= t(".current_market_price_label") %></dt>
+ <dd class="text-gray-900"><%= format_money trade.security.current_price %></dd>
+ </div>
+ <% end %>
- <% if trade.buy? %>
+ <% if trade.buy? && trade.unrealized_gain_loss.present? %>
<div class="flex items-center justify-between text-sm">
<dt class="text-gray-500"><%= t(".total_return_label") %></dt>
<dd style="color: <%= trade.unrealized_gain_loss.color %>;">