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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user