From 11902ec2e5158f82bd7bbfb6bea244e12e051210 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 18 Feb 2016 10:30:26 -0300 Subject: [PATCH] Accept parameter that allow to destroy old data when processing merit rules --- script/process_merit_rules.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/script/process_merit_rules.rb b/script/process_merit_rules.rb index db7e624..e338a4c 100755 --- a/script/process_merit_rules.rb +++ b/script/process_merit_rules.rb @@ -28,14 +28,16 @@ def create_action(obj, index, count) end end -#puts "Destroy all merit actions" -#Merit::Action.destroy_all -# -#count = Person.count -#Person.all.each.with_index(1) do |person, i| -# puts "#{i}/#{count} Remove sash from #{person.identifier}" -# person.sash.destroy unless person.sash.nil? -#end +if ARGV.length>0 && ARGV[0] == 'destroy_old' + puts "Destroy all merit actions" + Merit::Action.destroy_all + + count = Person.count + Person.all.each.with_index(1) do |person, i| + puts "#{i}/#{count} Remove sash from #{person.identifier}" + person.sash.destroy unless person.sash.nil? + end +end # avoid updating level on every action for increasing performance Merit.observers.delete('RankObserver') -- libgit2 0.21.2