@ -44,8 +44,8 @@ class CollegesController < ApplicationController
(SELECTcount(c.id)FROMcoursesc,course_membersmWHEREc.id!=1309andm.course_id=c.idANDm.user_id=users.idANDm.rolein(1,2,3)andc.school_id=#{current_school.id} AND c.is_delete = 0) as course_count
(SELECTcount(c.id)FROMcoursesc,course_membersmWHEREc.id!=1309andm.course_id=c.idANDm.user_id=users.idANDm.rolein(1,2,3)andc.school_id=#{current_school.id} AND c.is_delete = 0) as course_count
FROM`users`,user_extensionsuewhereue.school_id=#{current_school.id} and users.id=ue.user_id and ue.identity=0 ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
FROM`users`,user_extensionsuewhereue.school_id=#{current_school.id} and users.id=ue.user_id and ue.identity=0 ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
.select('SUM(IF(identity=0, 1, 0)) AS teachers_count').first.teachers_count
# .select('SUM(IF(identity=0, 1, 0)) AS teachers_count').first.teachers_count
@teachers=
@teachers=
@teachers.mapdo|teacher|
@teachers.mapdo|teacher|
course_ids=Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{current_school.id}")
course_ids=Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{current_school.id}")
@ -99,7 +99,7 @@ class CollegesController < ApplicationController