Commit 11902ec2e5158f82bd7bbfb6bea244e12e051210

Authored by Victor Costa
1 parent 71cd203a
Exists in master

Accept parameter that allow to destroy old data when processing merit rules

Showing 1 changed file with 10 additions and 8 deletions   Show diff stats
script/process_merit_rules.rb
... ... @@ -28,14 +28,16 @@ def create_action(obj, index, count)
28 28 end
29 29 end
30 30  
31   -#puts "Destroy all merit actions"
32   -#Merit::Action.destroy_all
33   -#
34   -#count = Person.count
35   -#Person.all.each.with_index(1) do |person, i|
36   -# puts "#{i}/#{count} Remove sash from #{person.identifier}"
37   -# person.sash.destroy unless person.sash.nil?
38   -#end
  31 +if ARGV.length>0 && ARGV[0] == 'destroy_old'
  32 + puts "Destroy all merit actions"
  33 + Merit::Action.destroy_all
  34 +
  35 + count = Person.count
  36 + Person.all.each.with_index(1) do |person, i|
  37 + puts "#{i}/#{count} Remove sash from #{person.identifier}"
  38 + person.sash.destroy unless person.sash.nil?
  39 + end
  40 +end
39 41  
40 42 # avoid updating level on every action for increasing performance
41 43 Merit.observers.delete('RankObserver')
... ...