mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* Add tax treatment metrics to reports, forms, and models - Implement `build_gains_by_tax_treatment` for grouping gains by tax treatment - Update investment performance view with tax treatment breakdown - Add tax treatment field to crypto and investments forms - Introduce `realized_gain_loss` calculation in the Trade model - Group investment subtypes by region for improved dropdown organization * Optimize investment performance report by reducing N+1 queries - Eager-load associations in `build_gains_by_tax_treatment` to minimize database queries - Preload holdings for realized gain/loss calculations in trades - Refactor views to standardize "no data" placeholder using translations - Adjust styling in tax treatment breakdown for improved layout * Enhance investment performance translations and optimize holdings lookup logic - Update `holdings_count` and `sells_count` translations to handle pluralization - Refactor views to use pluralized translation keys with count interpolation - Optimize preloaded holdings lookup in `Trade` to ensure deterministic selection using `select` and `max_by` * Refine preloaded holdings logic in `Trade` model - Treat empty preloaded holdings as authoritative to prevent unnecessary DB queries - Add explicit fallback behavior for database query when holdings are not preloaded --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
12 lines
547 B
Plaintext
12 lines
547 B
Plaintext
<%# locals: (account:, url:) %>
|
|
|
|
<%= render "accounts/form", account: account, url: url do |form| %>
|
|
<%= form.fields_for :accountable do |crypto_form| %>
|
|
<%= crypto_form.select :tax_treatment,
|
|
Crypto.tax_treatments.keys.map { |k| [t("accounts.tax_treatments.#{k}"), k] },
|
|
{ label: t("cryptos.form.tax_treatment_label"), include_blank: false },
|
|
{} %>
|
|
<p class="text-xs text-secondary mt-1"><%= t("cryptos.form.tax_treatment_hint") %></p>
|
|
<% end %>
|
|
<% end %>
|