more efficient calculation of ballot lines

This commit is contained in:
rgarcia
2017-07-01 00:05:54 +02:00
committed by Javi Martín
parent e5ec0bf6bb
commit 50c0f5f287

View File

@@ -31,7 +31,7 @@ class Budget
end
def total_votes
stats_cache("total_votes") { @budget.ballots.map(&:lines).count }
stats_cache("total_votes") { @budget.ballots.pluck(:ballot_lines_count).inject(0) { |sum, x| sum + x } }
end
def total_selected_investments