Commit 7a43e250ac590bf60f6497cf68ee1310d95e6ac9
1 parent
6f252a32
Exists in
master
and in
9 other branches
Fix ranking
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
lib/proposals_discussion_plugin/api.rb
@@ -10,7 +10,7 @@ class ProposalsDiscussionPlugin::API < Grape::API | @@ -10,7 +10,7 @@ class ProposalsDiscussionPlugin::API < Grape::API | ||
10 | 10 | ||
11 | proposals = article.proposals.map do |proposal| | 11 | proposals = article.proposals.map do |proposal| |
12 | w = [(proposal.hits - max_hits).abs, (proposal.hits - min_hits).abs].max.to_f | 12 | w = [(proposal.hits - max_hits).abs, (proposal.hits - min_hits).abs].max.to_f |
13 | - effective_support = (proposal.votes_for - proposal.votes_against)/w | 13 | + effective_support = (proposal.votes_for - proposal.votes_against)/(1+w) |
14 | 14 | ||
15 | {:id => proposal.id, :abstract => proposal.abstract, :votes_for => proposal.votes_for, :votes_against => proposal.votes_against, :hits => proposal.hits, :effective_support => effective_support} | 15 | {:id => proposal.id, :abstract => proposal.abstract, :votes_for => proposal.votes_for, :votes_against => proposal.votes_against, :hits => proposal.hits, :effective_support => effective_support} |
16 | end | 16 | end |