mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-22 14:49:38 +02:00
fix n+1 for categories (#1693)
This commit is contained in:
parent
eabfb7aae1
commit
d2a7aef6ef
1 changed files with 1 additions and 1 deletions
|
@ -94,7 +94,7 @@ class Budget < ApplicationRecord
|
||||||
# Continuous gray segment for empty budgets
|
# Continuous gray segment for empty budgets
|
||||||
return [ { color: "#F0F0F0", amount: 1, id: unused_segment_id } ] unless allocations_valid?
|
return [ { color: "#F0F0F0", amount: 1, id: unused_segment_id } ] unless allocations_valid?
|
||||||
|
|
||||||
segments = budget_categories.map do |bc|
|
segments = budget_categories.includes(:category).map do |bc|
|
||||||
{ color: bc.category.color, amount: bc.actual_spending, id: bc.id }
|
{ color: bc.category.color, amount: bc.actual_spending, id: bc.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue