Commit 1f82a5630995c05334e91cc57d4e49300c9bdd7e
1 parent
8c614360
Exists in
master
Check if voter if existent on badge rules
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
lib/ext/entities.rb
@@ -67,7 +67,7 @@ module Merit | @@ -67,7 +67,7 @@ module Merit | ||
67 | action: 'vote#create', | 67 | action: 'vote#create', |
68 | default_threshold: 5, | 68 | default_threshold: 5, |
69 | to: lambda {|vote| vote.voteable.author}, | 69 | to: lambda {|vote| vote.voteable.author}, |
70 | - 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 } | 70 | + value: lambda { |vote, author| (vote.voteable.profile.identifier == 'conferencia' and author.present?) ? Vote.where(voteable_id: Article.conference_articles.select("articles.id")).for_voteable(vote.voteable).where('vote < 0').count : 0 } |
71 | } | 71 | } |
72 | ], | 72 | ], |
73 | votes_performed_conferencia: [ | 73 | votes_performed_conferencia: [ |
@@ -75,7 +75,7 @@ module Merit | @@ -75,7 +75,7 @@ module Merit | ||
75 | action: 'vote#create', | 75 | action: 'vote#create', |
76 | default_threshold: 5, | 76 | default_threshold: 5, |
77 | to: lambda {|vote| vote.voter}, | 77 | to: lambda {|vote| vote.voter}, |
78 | - value: lambda { |vote, voter| vote.voteable.profile.identifier == 'conferencia' ? Vote.where(voteable_id: Article.conference_articles.select("articles.id")).for_voter(voter).count : 0} | 78 | + value: lambda { |vote, voter| (vote.voteable.profile.identifier == 'conferencia' and voter.present?) ? Vote.where(voteable_id: Article.conference_articles.select("articles.id")).for_voter(voter).count : 0} |
79 | } | 79 | } |
80 | ], | 80 | ], |
81 | creative_conferencia: [ | 81 | creative_conferencia: [ |