1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 15:05:22 +02:00

perf(transactions): add kind to Transaction model and remove expensive Transfer joins in aggregations (#2388)

* add kind to transaction model

* Basic transfer creator

* Fix method naming conflict

* Creator form pattern

* Remove stale methods

* Tweak migration

* Remove BaseQuery, write entire query in each class for clarity

* Query optimizations

* Remove unused exchange rate query lines

* Remove temporary cache-warming strategy

* Fix test

* Update transaction search

* Decouple transactions endpoint from IncomeStatement

* Clean up transactions controller

* Update cursor rules

* Cleanup comments, logic in search

* Fix totals logic on transactions view

* Fix pagination

* Optimize search totals query

* Default to last 30 days on transactions page if no filters

* Decouple transactions list from transfer details

* Revert transfer route

* Migration reset

* Bundle update

* Fix matching logic, tests

* Remove unused code
This commit is contained in:
Zach Gollwitzer 2025-06-20 13:31:58 -04:00 committed by GitHub
parent 7aca5a2277
commit 1aae00f586
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 1749 additions and 705 deletions

View file

@ -1,14 +1,11 @@
<%# locals: (entry:) %>
<%# locals: (model:, account:) %>
<% type = params[:type] || "buy" %>
<%= styled_form_with model: entry, url: trades_path, data: { controller: "trade-form" } do |form| %>
<%= form.hidden_field :account_id %>
<%= styled_form_with url: trades_path(account_id: account&.id), scope: :model, data: { controller: "trade-form" } do |form| %>
<div class="space-y-4">
<% if entry.errors.any? %>
<%= render "shared/form_errors", model: entry %>
<% if model.errors.any? %>
<%= render "shared/form_errors", model: model %>
<% end %>
<div class="space-y-2">
@ -22,7 +19,7 @@
{ label: t(".type"), selected: type },
{ data: {
action: "trade-form#changeType",
trade_form_url_param: new_trade_path(account_id: entry.account&.id || entry.account_id),
trade_form_url_param: new_trade_path(account_id: account&.id),
trade_form_key_param: "type",
}} %>
@ -41,10 +38,10 @@
<% end %>
<% end %>
<%= form.date_field :date, label: true, value: Date.current, required: true %>
<%= form.date_field :date, label: true, value: model.date || Date.current, required: true %>
<% unless %w[buy sell].include?(type) %>
<%= form.money_field :amount, label: t(".amount"), required: true %>
<%= form.money_field :amount, label: t(".amount"), value: model.amount, required: true %>
<% end %>
<% if %w[deposit withdrawal].include?(type) %>

View file

@ -1,6 +1,6 @@
<%= render DialogComponent.new do |dialog| %>
<% dialog.with_header(title: t(".title")) %>
<% dialog.with_body do %>
<%= render "trades/form", entry: @entry %>
<%= render "trades/form", model: @model, account: @account %>
<% end %>
<% end %>