|
|
@ -83,11 +83,11 @@ class Management::SchoolReportService
|
|
|
|
.select("#{base_query_column}, COUNT(*) student_count")
|
|
|
|
.select("#{base_query_column}, COUNT(*) student_count")
|
|
|
|
when 'homework_count' then
|
|
|
|
when 'homework_count' then
|
|
|
|
schools.joins('LEFT JOIN courses ON courses.school_id = schools.id')
|
|
|
|
schools.joins('LEFT JOIN courses ON courses.school_id = schools.id')
|
|
|
|
.joins('LEFT JOIN homework_commons hc ON shc.course_id = courses.id AND hc.homework_type = 4')
|
|
|
|
.joins('LEFT JOIN homework_commons hc ON hc.course_id = courses.id AND hc.homework_type = 4')
|
|
|
|
.select("#{base_query_column}, COUNT(*) homework_count")
|
|
|
|
.select("#{base_query_column}, COUNT(*) homework_count")
|
|
|
|
when 'other_homework_count' then
|
|
|
|
when 'other_homework_count' then
|
|
|
|
schools.joins('LEFT JOIN courses ON courses.school_id = schools.id')
|
|
|
|
schools.joins('LEFT JOIN courses ON courses.school_id = schools.id')
|
|
|
|
.joins('LEFT JOIN homework_commons hc ON shc.course_id = courses.id AND hc.homework_type IN (1, 3)')
|
|
|
|
.joins('LEFT JOIN homework_commons hc ON hc.course_id = courses.id AND hc.homework_type IN (1, 3)')
|
|
|
|
.select("#{base_query_column}, COUNT(*) other_homework_count")
|
|
|
|
.select("#{base_query_column}, COUNT(*) other_homework_count")
|
|
|
|
when 'course_count' then
|
|
|
|
when 'course_count' then
|
|
|
|
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0')
|
|
|
|
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0')
|
|
|
|