Commit 2f6dced25241451770f57a77a0348cb69a24efc7
1 parent
6b84f010
Exists in
master
and in
1 other branch
Improve script
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
lib/gamification_plugin.rb
@@ -35,7 +35,7 @@ class GamificationPlugin < Noosfero::Plugin | @@ -35,7 +35,7 @@ class GamificationPlugin < Noosfero::Plugin | ||
35 | 35 | ||
36 | def body_ending | 36 | def body_ending |
37 | proc do | 37 | proc do |
38 | - if current_person.present? | 38 | + if current_person.present? && response.status == 200 |
39 | badges = current_person.badges.notification_pending.all | 39 | badges = current_person.badges.notification_pending.all |
40 | current_person.sash.notify_all_badges_from_user | 40 | current_person.sash.notify_all_badges_from_user |
41 | render :file => 'gamification/display_notifications', :locals => {:badges => badges} | 41 | render :file => 'gamification/display_notifications', :locals => {:badges => badges} |
script/process_merit_rules.rb
@@ -42,4 +42,9 @@ Environment.all.each do |environment| | @@ -42,4 +42,9 @@ Environment.all.each do |environment| | ||
42 | end | 42 | end |
43 | end | 43 | end |
44 | 44 | ||
45 | + environment.people.each.with_index(1) do |person, person_index| | ||
46 | + puts "Updating #{person.identifier} level" | ||
47 | + person.update_attribute(:level, person.gamification_plugin_calculate_level) | ||
48 | + end | ||
49 | + | ||
45 | end | 50 | end |