diff --git a/lib/noosfero/api/v1/articles.rb b/lib/noosfero/api/v1/articles.rb index 80f754d..80bc591 100644 --- a/lib/noosfero/api/v1/articles.rb +++ b/lib/noosfero/api/v1/articles.rb @@ -37,7 +37,7 @@ module Noosfero articles = articles.display_filter(current_person, nil) if votes_order - articles = articles.joins(:votes).group('articles.id').reorder('sum(votes.id) DESC') + articles = articles.joins('left join votes on articles.id=votes.voteable_id').group('articles.id').reorder('sum(coalesce(votes.vote, 0)) DESC') end present articles, :with => Entities::Article, :fields => params[:fields] -- libgit2 0.21.2