diff --git a/lib/ext/entities.rb b/lib/ext/entities.rb index 3bb664b..df2aeea 100644 --- a/lib/ext/entities.rb +++ b/lib/ext/entities.rb @@ -59,7 +59,7 @@ module Merit action: 'vote#create', default_threshold: 5, to: lambda {|vote| vote.voteable.author}, - value: lambda { |vote, author| vote.voteable.profile.identifier == 'conferencia' ? Vote.for_voteable(vote.voteable).where('vote > 0').count : 0 } + value: lambda { |vote, author| vote.voteable.profile.identifier == 'conferencia' ? Vote.where(voteable_id: Article.conference_articles.select("articles.id")).for_voteable(vote.voteable).where('vote > 0').count : 0 } } ], negative_votes_received_conferencia: [ @@ -67,7 +67,7 @@ module Merit action: 'vote#create', default_threshold: 5, to: lambda {|vote| vote.voteable.author}, - value: lambda { |vote, author| vote.voteable.profile.identifier == 'conferencia' ? Vote.for_voteable(vote.voteable).where('vote < 0').count : 0 } + value: lambda { |vote, author| vote.voteable.profile.identifier == 'conferencia' ? Vote.where(voteable_id: Article.conference_articles.select("articles.id")).for_voteable(vote.voteable).where('vote < 0').count : 0 } } ], votes_performed_conferencia: [ @@ -75,7 +75,7 @@ module Merit action: 'vote#create', default_threshold: 5, to: lambda {|vote| vote.voter}, - value: lambda { |vote, voter| vote.voteable.profile.identifier == 'conferencia' ? Vote.for_voter(voter).count : 0} + value: lambda { |vote, voter| vote.voteable.profile.identifier == 'conferencia' ? Vote.where(voteable_id: Article.conference_articles.select("articles.id")).for_voter(voter).count : 0} } ], creative_conferencia: [ -- libgit2 0.21.2