From 3e8e995f9ef542f97f96738864fa25819ead3630 Mon Sep 17 00:00:00 2001 From: Hugo Melo Date: Wed, 28 Oct 2015 19:06:13 -0200 Subject: [PATCH] Fix vote filtering by profile on export_ranking --- script/export_ranking.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script/export_ranking.rb b/script/export_ranking.rb index 951b62a..836156a 100644 --- a/script/export_ranking.rb +++ b/script/export_ranking.rb @@ -37,15 +37,18 @@ profile_ids.each do |profile_id| person_down_votes = person.comments.joins(:votes).where('vote < 0').count + person_articles.joins(:votes).where('vote < 0').count person_comments = person.comments.count person_followers = (person.following_articles & person.article_followers.where(article_id: person_articles)).count + votes = Vote.for_voter(person).count else person_articles = profile.articles.where(:author_id => person.id) person_up_votes = person.comments.where(:source_id => profile.articles).joins(:votes).where('vote > 0').count + person_articles.joins(:votes).where('vote > 0').count person_down_votes = person.comments.where(:source_id => profile.articles).joins(:votes).where('vote < 0').count + person_articles.joins(:votes).where('vote < 0').count person_comments = person.comments.where(:source_id => profile.articles).count person_followers = (person.following_articles & person.article_followers.where(article_id: profile.articles)).count + the_votes = Vote.for_voter(person) + votes = the_votes.where(voteable_type: 'Article', voteable_id: profile.articles).count + the_votes.where(voteable_type: 'Comment', voteable_id: Comment.where(source_type: ["ProposalsDiscussionPlugin::Proposal", "Article"], source_id: profile.articles)).count end quantities_values = [ - Vote.for_voter(person).count, + votes, person.friends.count, person_up_votes, person_down_votes, -- libgit2 0.21.2