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

This commit is contained in:
BitToby
2026-02-14 06:45:50 -03:00
committed by GitHub
parent 9ce7669e1c
commit 170bd2858d
2 changed files with 2 additions and 2 deletions

View File

@@ -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">

View File

@@ -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,