From 2f6dced25241451770f57a77a0348cb69a24efc7 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Mon, 27 Jul 2015 16:55:00 -0300 Subject: [PATCH] Improve script --- lib/gamification_plugin.rb | 2 +- script/process_merit_rules.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/gamification_plugin.rb b/lib/gamification_plugin.rb index 7b25b28..65c5574 100644 --- a/lib/gamification_plugin.rb +++ b/lib/gamification_plugin.rb @@ -35,7 +35,7 @@ class GamificationPlugin < Noosfero::Plugin def body_ending proc do - if current_person.present? + if current_person.present? && response.status == 200 badges = current_person.badges.notification_pending.all current_person.sash.notify_all_badges_from_user render :file => 'gamification/display_notifications', :locals => {:badges => badges} diff --git a/script/process_merit_rules.rb b/script/process_merit_rules.rb index fc153f5..c387738 100644 --- a/script/process_merit_rules.rb +++ b/script/process_merit_rules.rb @@ -42,4 +42,9 @@ Environment.all.each do |environment| end end + environment.people.each.with_index(1) do |person, person_index| + puts "Updating #{person.identifier} level" + person.update_attribute(:level, person.gamification_plugin_calculate_level) + end + end -- libgit2 0.21.2