diff --git a/app/tasks/statistic_school_daily_report_task.rb b/app/tasks/statistic_school_daily_report_task.rb index 4955c1e9..a588b5f6 100644 --- a/app/tasks/statistic_school_daily_report_task.rb +++ b/app/tasks/statistic_school_daily_report_task.rb @@ -1,5 +1,6 @@ class StatisticSchoolDailyReportTask def call + begin_evaluate = EvaluateRecord.where("created_at <'#{yesterday.first}'").reorder("id desc").limit(1) School.find_each do |school| # 新增教师和学生 users = User.joins(:user_extensions) @@ -30,6 +31,7 @@ class StatisticSchoolDailyReportTask .joins('LEFT JOIN homework_commons hc ON hcs.homework_common_id = hc.id AND hc.homework_type = 4') .joins('LEFT JOIN course_members ON course_members.user_id = evaluate_records.user_id') .joins('LEFT JOIN courses ON course_members.course_id = courses.id AND hc.course_id = courses.id') + .where("evaluate_records.id > ?", begin_evaluate.first.id) .where(courses: { school_id: school.id }) .where(created_at: yesterday).reorder(nil).count # shixun_evaluate_count = 0