Commit d7d95595388bd75b3d1be982287da6372616b3d3

Authored by Hugo Melo
1 parent 046756e4

Move people level update outside the pontuation block

Showing 1 changed file with 5 additions and 0 deletions   Show diff stats
script/check_merit_actions_vs_points.rb
... ... @@ -134,6 +134,11 @@ Environment.all.each do |environment|
134 134 end
135 135 puts
136 136 end
  137 + end
  138 +
  139 + # update everyone's level after the whole pontuation,
  140 + # which is much faster than on every created action
  141 + environment.people.find_each(batch_size: 100) do |person|
137 142 puts "Updating #{person.identifier} level\n"
138 143 person.update_attribute(:level, person.gamification_plugin_calculate_level)
139 144 end
... ...