Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Fix trade detail Buy/Sell type selection (#3668)

Niels Eulink7cc6aa011f86
diff --git a/app/views/trades/show.html.erb b/app/views/trades/show.html.erb
index 05519c726c..7fe0772fdb 100644
--- a/app/views/trades/show.html.erb
+++ b/app/views/trades/show.html.erb
@@ -42,7 +42,7 @@
<div class="flex items-center gap-2">
<%= f.select :nature,
[[t(".buy"), "outflow"], [t(".sell"), "inflow"]],
- { container_class: "w-1/3", label: t(".type_label"), selected: @entry.amount.positive? ? "outflow" : "inflow" },
+ { container_class: "w-1/3", label: t(".type_label"), selected: trade.buy? ? "outflow" : "inflow" },
{ data: { "auto-submit-form-target": "auto" }, disabled: @entry.linked? } %>
<%= f.fields_for :entryable do |ef| %>
<%= ef.number_field :qty,