Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-07-10 17:58:20 +08:00
commit 7dd87212a4
1 changed files with 2 additions and 3 deletions

View File

@ -734,10 +734,9 @@ class CoursesService
user_list = []
max_size = 0
if params[:type] == 1
homework_count = Course.find(params[:course_id]).homework_commons.count
sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" <<
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) GROUP BY student_works.user_id ORDER BY score limit #{page*10},10"
sql = "select users.*,sum(student_works.final_score) score from student_works left outer join users on student_works.user_id = users.id" <<
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) GROUP BY student_works.user_id ORDER BY score desc limit #{page*10},10"
sql_count = " select count(distinct(student_works.user_id) ) " <<
" from student_works left outer join users on student_works.user_id = users.id " <<
" where homework_common_id in " <<