Commit a1650079fc83bde57f8ae72ac51b8caf8bba6d98
1 parent
039489a7
Exists in
master
and in
7 other branches
Fix ranking
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
lib/proposals_discussion_plugin/proposals_holder.rb
... | ... | @@ -41,7 +41,7 @@ class ProposalsDiscussionPlugin::ProposalsHolder < Folder |
41 | 41 | end |
42 | 42 | |
43 | 43 | def ranking |
44 | - ProposalsDiscussionPlugin::RankingItem.joins(:proposal => :parent).where('parents_articles.id' => self.id)#.order(:position) | |
44 | + ProposalsDiscussionPlugin::RankingItem.joins(:proposal => :parent).where('parents_articles.id' => self.id).order(:position) | |
45 | 45 | end |
46 | 46 | |
47 | 47 | def compute_ranking |
... | ... | @@ -54,7 +54,7 @@ class ProposalsDiscussionPlugin::ProposalsHolder < Folder |
54 | 54 | |
55 | 55 | ProposalsDiscussionPlugin::RankingItem.new(:proposal => proposal, :abstract => proposal.abstract, :votes_for => proposal.votes_for, :votes_against => proposal.votes_against, :hits => proposal.hits, :effective_support => effective_support) |
56 | 56 | end |
57 | - ranking.sort_by { |p| p.effective_support }.reverse | |
57 | + ranking = ranking.sort_by { |p| p.effective_support.to_f }.reverse | |
58 | 58 | ranking.each_with_index { |p, i| p.position = i+1 } |
59 | 59 | end |
60 | 60 | ... | ... |