dev_trainings
p31729568 6 years ago
parent 4ebe247633
commit 2aec2cafb7

@ -46,14 +46,14 @@ class Management::SchoolDataGrowService
.joins('LEFT JOIN school_daily_active_users au ON au.school_daily_report_id = sdr.id') .joins('LEFT JOIN school_daily_active_users au ON au.school_daily_report_id = sdr.id')
reports = search_filter(reports) reports = search_filter(reports)
reports.select( reports.select(
'SUM(teacher_increase_count) teacher_increase_count,'\ 'SUM(distinct teacher_increase_count) teacher_increase_count,'\
'SUM(student_increase_count) student_increase_count,'\ 'SUM(distinct student_increase_count) student_increase_count,'\
'SUM(course_increase_count) course_increase_count,'\ 'SUM(distinct course_increase_count) course_increase_count,'\
'SUM(shixun_increase_count) shixun_increase_count,'\ 'SUM(distinct shixun_increase_count) shixun_increase_count,'\
'SUM(shixun_homework_count) shixun_homework_count,'\ 'SUM(distinct shixun_homework_count) shixun_homework_count,'\
'SUM(shixun_evaluate_count) shixun_evaluate_count,'\ 'SUM(distinct shixun_evaluate_count) shixun_evaluate_count,'\
'COUNT(distinct au.user_id) uniq_active_user_count,'\ 'COUNT(distinct au.user_id) uniq_active_user_count,'\
'SUM(active_user_count) active_user_count' 'SUM(distinct active_user_count) active_user_count'
).first ).first
end end
end end
@ -72,14 +72,14 @@ class Management::SchoolDataGrowService
def joins_school_daily_report_sql def joins_school_daily_report_sql
SchoolDailyReport.joins('LEFT JOIN school_daily_active_users au ON au.school_daily_report_id = school_daily_reports.id') SchoolDailyReport.joins('LEFT JOIN school_daily_active_users au ON au.school_daily_report_id = school_daily_reports.id')
.select('school_id, '\ .select('school_id, '\
'SUM(teacher_increase_count) teacher_increase_count,'\ 'SUM(distinct teacher_increase_count) teacher_increase_count,'\
'SUM(student_increase_count) student_increase_count,'\ 'SUM(distinct student_increase_count) student_increase_count,'\
'SUM(course_increase_count) course_increase_count,'\ 'SUM(distinct course_increase_count) course_increase_count,'\
'SUM(shixun_increase_count) shixun_increase_count,'\ 'SUM(distinct shixun_increase_count) shixun_increase_count,'\
'SUM(shixun_homework_count) shixun_homework_count,'\ 'SUM(distinct shixun_homework_count) shixun_homework_count,'\
'SUM(shixun_evaluate_count) shixun_evaluate_count,'\ 'SUM(distinct shixun_evaluate_count) shixun_evaluate_count,'\
'COUNT(distinct au.user_id) uniq_active_user_count,'\ 'COUNT(distinct au.user_id) uniq_active_user_count,'\
'SUM(active_user_count) active_user_count') 'SUM(distinct active_user_count) active_user_count')
.where(date_condition_sql).group(:school_id).to_sql .where(date_condition_sql).group(:school_id).to_sql
end end

Loading…
Cancel
Save