Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix: inverted Buy/Sell type selection by changing amount.negative to amount.positive in trade edit views (#952)

BitToby170bd2858d6f
diff --git a/app/views/trades/_header.html.erb b/app/views/trades/_header.html.erb
index c35f56896f..68976a3920 100644
--- a/app/views/trades/_header.html.erb
+++ b/app/views/trades/_header.html.erb
@@ -3,7 +3,7 @@
<div id="<%= dom_id(entry, :header) %>">
<%= tag.header class: "mb-4 space-y-1" do %>
<span class="text-secondary text-sm">
- <%= entry.amount.negative? ? t(".buy") : t(".sell") %>
+ <%= entry.amount.positive? ? t(".buy") : t(".sell") %>
</span>
<div class="flex items-center gap-4">
diff --git a/app/views/trades/show.html.erb b/app/views/trades/show.html.erb
index 75c36f5279..31f49fe279 100644
--- a/app/views/trades/show.html.erb
+++ b/app/views/trades/show.html.erb
@@ -22,7 +22,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.negative? ? "outflow" : "inflow" },
+ { container_class: "w-1/3", label: t(".type_label"), selected: @entry.amount.positive? ? "outflow" : "inflow" },
{ data: { "auto-submit-form-target": "auto" }, disabled: @entry.linked? } %>
<%= f.fields_for :entryable do |ef| %>
<%= ef.number_field :qty,