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

Fix query when account has zero income and expense (#1112)

* Reproduce error

* Apply fix

* Remove uneeded helper
This commit is contained in:
Zach Gollwitzer 2024-08-20 15:44:32 -04:00 committed by GitHub
parent 793a6027a3
commit 37ae51f68a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View file

@ -46,7 +46,8 @@ class Family < ApplicationRecord
.where("account_entries.date <= ?", period.date_range.end)
.where("account_entries.marked_as_transfer = ?", false)
.where("account_entries.entryable_type = ?", "Account::Transaction")
.group("id")
.group("accounts.id")
.having("SUM(ABS(account_entries.amount)) > 0")
.to_a
results.each do |r|