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
|
class ProposalSupportsQuery
|
||||||
attr_reader :params
|
attr_reader :params
|
||||||
|
|
||||||
@@ -18,6 +16,12 @@ class ProposalSupportsQuery
|
|||||||
grouped_votes[group] = votes.inject(0) { |sum, vote| sum + vote.vote_weight }
|
grouped_votes[group] = votes.inject(0) { |sum, vote| sum + vote.vote_weight }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
accumulated = 0
|
||||||
|
grouped_votes.each do |k, v|
|
||||||
|
accumulated += v
|
||||||
|
grouped_votes[k] = accumulated
|
||||||
|
end
|
||||||
|
|
||||||
grouped_votes
|
grouped_votes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user