Commit 3e56d44f50c74a07b0591631adf3c98c2d485038

Authored by Leandro Santos
1 parent 9b9bf5d8

use group controle

Showing 1 changed file with 2 additions and 3 deletions   Show diff stats
script/process_merit_rules.rb
@@ -75,12 +75,11 @@ Environment.all.each do |environment| @@ -75,12 +75,11 @@ Environment.all.each do |environment|
75 end 75 end
76 76
77 group_control = YAML.load(File.read(File.join(Rails.root,'tmp','control_group.yml'))) if File.exist?(File.join(Rails.root,'tmp','control_group.yml')) 77 group_control = YAML.load(File.read(File.join(Rails.root,'tmp','control_group.yml'))) if File.exist?(File.join(Rails.root,'tmp','control_group.yml'))
78 - conditions = group_control.nil? ? {} : {:identifier => group_control[profile_id]['profiles']} 78 + conditions = group_control.nil? ? {} : {:identifier => group_control.map{|k,v| v['profiles']}.flatten}
79 people_count = environment.people.where(conditions).count 79 people_count = environment.people.where(conditions).count
80 person_index = 0 80 person_index = 0
81 puts "Analising environment people" 81 puts "Analising environment people"
82 -puts conditions.inspect  
83 - environment.people.find_each(conditions) do |person| 82 + environment.people.find_each(:conditions => conditions) do |person|
84 person_index += 1 83 person_index += 1
85 puts "Analising person #{person_index} of #{people_count}" 84 puts "Analising person #{person_index} of #{people_count}"
86 create_action(person, person_index, people_count) 85 create_action(person, person_index, people_count)