Commit 690bde3e70685437fdc6e23bbbe5b544df40353d

Authored by Victor Costa
Committed by Rodrigo Souto
1 parent 9d67b0b9

api: fix votes order

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
lib/noosfero/api/v1/articles.rb
... ... @@ -37,7 +37,7 @@ module Noosfero
37 37 articles = articles.display_filter(current_person, nil)
38 38  
39 39 if votes_order
40   - articles = articles.joins(:votes).group('articles.id').reorder('sum(votes.id) DESC')
  40 + articles = articles.joins('left join votes on articles.id=votes.voteable_id').group('articles.id').reorder('sum(coalesce(votes.vote, 0)) DESC')
41 41 end
42 42  
43 43 present articles, :with => Entities::Article, :fields => params[:fields]
... ...