Commit 5e413c4834b708fadee8f02ab944908f03837a3d
1 parent
d8043c6f
Exists in
master
and in
1 other branch
updating proces script
Showing
1 changed file
with
12 additions
and
8 deletions
Show diff stats
script/process_merit_rules.rb
@@ -18,18 +18,22 @@ def create_action(obj, index, count) | @@ -18,18 +18,22 @@ def create_action(obj, index, count) | ||
18 | action = Merit::Action.find_by_target_id_and_target_model_and_action_method(obj.id, target_model, 'create') | 18 | action = Merit::Action.find_by_target_id_and_target_model_and_action_method(obj.id, target_model, 'create') |
19 | if action.nil? | 19 | if action.nil? |
20 | puts "#{index}/#{count} Create merit action for #{target_model} #{obj.id}" | 20 | puts "#{index}/#{count} Create merit action for #{target_model} #{obj.id}" |
21 | - obj.new_merit_action(:create) | 21 | + begin |
22 | + obj.new_merit_action(:create) | ||
23 | + rescue Exception => e | ||
24 | + puts "Could not be create: #{e.message}" | ||
25 | + end | ||
22 | end | 26 | end |
23 | end | 27 | end |
24 | 28 | ||
25 | -#puts "Destroy all merit actions" | ||
26 | -#Merit::Action.destroy_all | 29 | +puts "Destroy all merit actions" |
30 | +Merit::Action.destroy_all | ||
27 | 31 | ||
28 | -#count = Person.count | ||
29 | -#Person.all.each.with_index(1) do |person, i| | ||
30 | - #puts "#{i}/#{count} Remove sash from #{person.identifier}" | ||
31 | - #person.sash.destroy unless person.sash.nil? | ||
32 | -#end | 32 | +count = Person.count |
33 | +Person.all.each.with_index(1) do |person, i| | ||
34 | + puts "#{i}/#{count} Remove sash from #{person.identifier}" | ||
35 | + person.sash.destroy unless person.sash.nil? | ||
36 | +end | ||
33 | 37 | ||
34 | Merit.observers << 'ProcessObserver' | 38 | Merit.observers << 'ProcessObserver' |
35 | 39 |