|
|
|
@ -7,7 +7,7 @@ class StatisticSchoolDailyReportTask
|
|
|
|
|
|
|
|
|
|
teacher_count = users.where(created_on: yesterday, user_extensions: { identity: User::TEACHER }).count
|
|
|
|
|
student_count = users.where(created_on: yesterday, user_extensions: { identity: User::STUDENT }).count
|
|
|
|
|
prefessional_count = users.where(created_on: yesterday, user_extensions: { identity: User::ENTERPRISE }).count
|
|
|
|
|
professional_count = users.where(created_on: yesterday, user_extensions: { identity: User::ENTERPRISE }).count
|
|
|
|
|
|
|
|
|
|
# 活跃用户
|
|
|
|
|
active_user_ids = users.where(last_login_on: yesterday).pluck(:id)
|
|
|
|
@ -34,13 +34,13 @@ class StatisticSchoolDailyReportTask
|
|
|
|
|
.where(created_at: yesterday).reorder(nil).count
|
|
|
|
|
|
|
|
|
|
# 无有效数据时不记录
|
|
|
|
|
data = [teacher_count, student_count, prefessional_count, course_count, shixun_count, active_user_count,
|
|
|
|
|
data = [teacher_count, student_count, professional_count, course_count, shixun_count, active_user_count,
|
|
|
|
|
shixun_homework_count, shixun_evaluate_count]
|
|
|
|
|
next if data.all?(&:zero?)
|
|
|
|
|
|
|
|
|
|
create_params = {
|
|
|
|
|
school_id: school.id, school_name: school.name, teacher_increase_count: teacher_count,
|
|
|
|
|
student_increase_count: student_count, prefessional_increase_count: prefessional_count, course_increase_count: course_count,
|
|
|
|
|
student_increase_count: student_count, professional_increase_count: professional_count, course_increase_count: course_count,
|
|
|
|
|
shixun_homework_count: shixun_homework_count, shixun_evaluate_count: shixun_evaluate_count,
|
|
|
|
|
shixun_increase_count: shixun_count, active_user_count: active_user_count, date: current_date
|
|
|
|
|
}
|
|
|
|
|