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

Improve speed of transactions page (#1752)
Some checks failed
Publish Docker image / ci (push) Has been cancelled
Publish Docker image / Build docker image (push) Has been cancelled

* Make demo data more realistic

* Fix N+1 transactions query

* Lint fixes

* Totals query

* Consolidate stats calcs

* Fix preload

* Fix filter clearing

* Fix N+1 queries for family sync detection

* Reduce queries for rendering transfers

* Fix tests

* Remove flaky test
This commit is contained in:
Zach Gollwitzer 2025-01-31 19:08:21 -05:00 committed by GitHub
parent 53f4b32c33
commit 2c2b600163
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 209 additions and 195 deletions

View file

@ -14,7 +14,7 @@
<%= render "account/transactions/selection_bar" %>
</div>
<% if @transaction_entries.present? %>
<% if @pagy.count > 0 %>
<div class="grow overflow-y-auto">
<div class="grid grid-cols-12 bg-gray-25 rounded-xl px-5 py-3 text-xs uppercase font-medium text-gray-500 items-center mb-4">
<div class="pl-0.5 col-span-8 flex items-center gap-4">
@ -28,13 +28,11 @@
<p class="col-span-2 justify-self-end">amount</p>
</div>
<div class="space-y-6">
<%= entries_by_date(@transaction_entries, totals: true) do |entries| %>
<%# Render transfers by selecting one side of the transfer (to prevent double-rendering the same transfer across date groups) %>
<%= render partial: "transfers/transfer",
collection: entries.select { |e| e.account_transaction.transfer? && e.account_transaction.transfer_as_outflow.present? }.map { |e| e.account_transaction.transfer_as_outflow } %>
<%= entries_by_date(@transaction_entries, transfers: @transfers, totals: true) do |entries, transfers| %>
<%= render partial: "transfers/transfer", collection: transfers %>
<%# Render regular entries %>
<%= render partial: "account/entries/entry", collection: entries.reject { |e| e.account_transaction.transfer? } %>
<%= render partial: "account/entries/entry", collection: entries.reject { |e| e.entryable.transfer? } %>
<% end %>
</div>
</div>