ADD 学院统计页面的“课堂”根据进行状态进行排序(正在进行排前面)

dev_partners
jasder 6 years ago
parent cfdb4f95c2
commit 3cec847e3b

@ -140,6 +140,7 @@ class CollegesController < ApplicationController
course[:task_count] = course.hcm_count.to_i + course.attachments_count.to_i + course.messages_count.to_i + course.hcm_nonshixun_count.to_i + course.exercises_count.to_i + course.polls_count.to_i course[:task_count] = course.hcm_count.to_i + course.attachments_count.to_i + course.messages_count.to_i + course.hcm_nonshixun_count.to_i + course.exercises_count.to_i + course.polls_count.to_i
end end
@courses = @courses.sort{|x,y| [y[:evaluating_count], y[:task_count]] <=> [x[:evaluating_count], x[:task_count]] } @courses = @courses.sort{|x,y| [y[:evaluating_count], y[:task_count]] <=> [x[:evaluating_count], x[:task_count]] }
@courses = @courses.sort_by { |course| course.is_end ? 1 : 0 }
# SELECT c.id, (select concat(firstname,lastname) from users u where u.id=c.tea_id) as username, # SELECT c.id, (select concat(firstname,lastname) from users u where u.id=c.tea_id) as username,
# (select count(sfc.id) from students_for_courses sfc where c.id=sfc.course_id group by c.id) as student_count, # (select count(sfc.id) from students_for_courses sfc where c.id=sfc.course_id group by c.id) as student_count,

Loading…
Cancel
Save