|
|
|
@ -5,7 +5,7 @@ namespace :sync_evaluate do
|
|
|
|
|
School.find_each do |school|
|
|
|
|
|
puts school.id
|
|
|
|
|
evaluate_count = Game.find_by_sql("select sum(g.evaluate_count) as e_count from games g, user_extensions ue where
|
|
|
|
|
g.user_id = ue.user_id and ue.school_id = #{school}.id").firt.try(:e_count)
|
|
|
|
|
g.user_id = ue.user_id and ue.school_id = #{school.id}").first.try(:e_count)
|
|
|
|
|
|
|
|
|
|
report = SchoolReport.find_or_initialize_by(school_id: school.id)
|
|
|
|
|
report.school_name = school.name
|
|
|
|
|