diff --git a/app/controllers/admins/user_schools_statistics_controller.rb b/app/controllers/admins/user_schools_statistics_controller.rb index 2290761da..38e966880 100644 --- a/app/controllers/admins/user_schools_statistics_controller.rb +++ b/app/controllers/admins/user_schools_statistics_controller.rb @@ -1,7 +1,7 @@ class Admins::UserSchoolsStatisticsController < Admins::BaseController def export - params[:per_page] = 10000 + params[:per_page] = 50 _count, @schools = Admins::UserSchoolsStatisticQuery.call(params) filename = ['用户运营统计', Time.zone.now.strftime('%Y%m%d%H%M%S')].join('-') << '.xlsx' diff --git a/lib/tasks/sync_evaluate.rake b/lib/tasks/sync_evaluate.rake new file mode 100644 index 000000000..f6f6e9482 --- /dev/null +++ b/lib/tasks/sync_evaluate.rake @@ -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 \ No newline at end of file