Commit 573c0838cd8d66a6d9b25323a6c58d2ac9302ccc
1 parent
68ce318d
Exists in
master
and in
1 other branch
Fix date in merit rules script
Showing
1 changed file
with
15 additions
and
1 deletions
Show diff stats
script/process_merit_rules.rb
1 | 1 | #!/usr/bin/env ruby |
2 | 2 | # encoding: UTF-8 |
3 | 3 | |
4 | +class ProcessObserver | |
5 | + def update(changed_data) | |
6 | + #puts changed_data | |
7 | + merit = changed_data[:merit_object] | |
8 | + if merit.kind_of?(Merit::Score::Point) | |
9 | + #puts "FIX" | |
10 | + action = Merit::Action.find(changed_data[:merit_action_id]) | |
11 | + merit.update_attribute(:created_at, YAML.load(action.target_data).created_at) | |
12 | + end | |
13 | + end | |
14 | +end | |
15 | + | |
4 | 16 | def create_action(obj, index, count) |
5 | 17 | target_model = obj.class.base_class.name.downcase |
6 | 18 | action = Merit::Action.find_by_target_id_and_target_model_and_action_method(obj.id, target_model, 'create') |
... | ... | @@ -12,13 +24,15 @@ end |
12 | 24 | |
13 | 25 | #puts "Destroy all merit actions" |
14 | 26 | #Merit::Action.destroy_all |
15 | - | |
27 | +# | |
16 | 28 | #count = Person.count |
17 | 29 | #Person.all.each.with_index(1) do |person, i| |
18 | 30 | # puts "#{i}/#{count} Remove sash from #{person.identifier}" |
19 | 31 | # person.sash.destroy unless person.sash.nil? |
20 | 32 | #end |
21 | 33 | |
34 | +Merit.observers << 'ProcessObserver' | |
35 | + | |
22 | 36 | Environment.all.each do |environment| |
23 | 37 | |
24 | 38 | Merit::AppPointRules.clear | ... | ... |