Commit 52dabec9447b17a72fb0815e87c8b4f4b5a056f8

Authored by Hugo Melo
1 parent 5e413c48

Add missing column on export_ranking

Showing 1 changed file with 5 additions and 4 deletions   Show diff stats
script/export_ranking.rb
@@ -39,10 +39,10 @@ profile_ids.each do |profile_id| @@ -39,10 +39,10 @@ profile_ids.each do |profile_id|
39 person_followers = (person.following_articles & person.article_followers.where(article_id: person_articles)).count 39 person_followers = (person.following_articles & person.article_followers.where(article_id: person_articles)).count
40 else 40 else
41 person_articles = profile.articles.where(:author_id => person.id) 41 person_articles = profile.articles.where(:author_id => person.id)
42 - person_up_votes = person.comments.where(:source_id => profile.articles).joins(:votes).where('vote > 0').count + person_articles.joins(:votes).where('vote > 0').count  
43 - person_down_votes = person.comments.where(:source_id => profile.articles).joins(:votes).where('vote < 0').count + person_articles.joins(:votes).where('vote < 0').count  
44 - person_comments = person.comments.where(:source_id => profile.articles).count  
45 - person_followers = (person.following_articles & person.article_followers.where(article_id: profile.articles)).count 42 + person_up_votes = person.comments.where(:source_id => profile.articles).joins(:votes).where('vote > 0').count + person_articles.joins(:votes).where('vote > 0').count
  43 + person_down_votes = person.comments.where(:source_id => profile.articles).joins(:votes).where('vote < 0').count + person_articles.joins(:votes).where('vote < 0').count
  44 + person_comments = person.comments.where(:source_id => profile.articles).count
  45 + person_followers = (person.following_articles & person.article_followers.where(article_id: profile.articles)).count
46 end 46 end
47 quantities_values = [ 47 quantities_values = [
48 Vote.for_voter(person).count, 48 Vote.for_voter(person).count,
@@ -50,6 +50,7 @@ profile_ids.each do |profile_id| @@ -50,6 +50,7 @@ profile_ids.each do |profile_id|
50 person_up_votes, 50 person_up_votes,
51 person_down_votes, 51 person_down_votes,
52 person_articles.count, 52 person_articles.count,
  53 + person_comments,
53 Comment.where(:source_id => person_articles).count, 54 Comment.where(:source_id => person_articles).count,
54 person_followers, 55 person_followers,
55 ArticleFollower.where(:article_id => person_articles).count 56 ArticleFollower.where(:article_id => person_articles).count