From d7d95595388bd75b3d1be982287da6372616b3d3 Mon Sep 17 00:00:00 2001 From: Hugo Melo Date: Tue, 3 Nov 2015 13:02:56 -0200 Subject: [PATCH] Move people level update outside the pontuation block --- script/check_merit_actions_vs_points.rb | 5 +++++ 1 file changed, 5 insertions(+), 0 deletions(-) diff --git a/script/check_merit_actions_vs_points.rb b/script/check_merit_actions_vs_points.rb index 8c4b053..78a7245 100644 --- a/script/check_merit_actions_vs_points.rb +++ b/script/check_merit_actions_vs_points.rb @@ -134,6 +134,11 @@ Environment.all.each do |environment| end puts end + end + + # update everyone's level after the whole pontuation, + # which is much faster than on every created action + environment.people.find_each(batch_size: 100) do |person| puts "Updating #{person.identifier} level\n" person.update_attribute(:level, person.gamification_plugin_calculate_level) end -- libgit2 0.21.2