Commit cb82846fcbfbd39f8e7b4a437b4c7a7696f335af

Authored by Victor Costa
1 parent 1b31877e

Fix pending badges notification

lib/gamification_plugin.rb
... ... @@ -36,7 +36,7 @@ class GamificationPlugin < Noosfero::Plugin
36 36 def body_ending
37 37 proc do
38 38 if current_person.present? && response.status == 200
39   - badges = current_person.badges.notification_pending.all
  39 + badges = current_person.badges.notification_pending
40 40 current_person.sash.notify_all_badges_from_user
41 41 render :file => 'gamification/display_notifications', :locals => {:badges => badges}
42 42 else
... ...
lib/gamification_plugin/badge.rb
... ... @@ -18,6 +18,6 @@ class GamificationPlugin::Badge < Noosfero::Plugin::ActiveRecord
18 18 Merit::BadgesSash.where(:badge_id => self.id).destroy_all
19 19 end
20 20  
21   - scope :notification_pending, :joins => :badges_sash, :conditions => ['badges_sashes.notified_user = false']
  21 + scope :notification_pending, :include => :badges_sash, :conditions => ['badges_sashes.notified_user = false']
22 22  
23 23 end
... ...