Fix proposal supports query

Proposal supports query was returning the supports received for each
group. Now it returns the supports received for the given group.
This commit is contained in:
Juan Salvador Pérez García
2018-06-22 09:59:46 +02:00
parent 7018c0fe45
commit 3aff0e96b2

View File

@@ -1,5 +1,3 @@
# frozen_string_literal: true
class ProposalSupportsQuery
attr_reader :params
@@ -18,6 +16,12 @@ class ProposalSupportsQuery
grouped_votes[group] = votes.inject(0) { |sum, vote| sum + vote.vote_weight }
end
accumulated = 0
grouped_votes.each do |k, v|
accumulated += v
grouped_votes[k] = accumulated
end
grouped_votes
end