Commit 423d9187d16143568b56b8110d309b6c89a742bc

Authored by Victor Costa
2 parents 57b46d76 9d9cedf2

Merge branch 'api' into stable

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