Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
af995b9dfa
@ -0,0 +1,17 @@
|
||||
desc "同步学院或者单位评测数"
|
||||
|
||||
namespace :sync_evaluate do
|
||||
task outpus_count: :environment 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)
|
||||
|
||||
report = SchoolReport.find_or_initialize_by(school_id: school.id)
|
||||
report.school_name = school.name
|
||||
report.shixun_evaluate_count = evaluate_count
|
||||
|
||||
report.save
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue