班级首页的活跃度和英雄榜由3个增加到6个

This commit is contained in:
cxt 2016-11-10 17:28:14 +08:00
parent 4a5e350615
commit 1e0c2e5d6a
1 changed files with 3 additions and 3 deletions

View File

@ -895,7 +895,7 @@ module CoursesHelper
desc.html_safe desc.html_safe
end end
# 学生按作业总分排序,取前3 # 学生按作业总分排序,取前6
def hero_homework_score(course, score_sort_by) def hero_homework_score(course, score_sort_by)
sql_select = "SELECT members.*,( sql_select = "SELECT members.*,(
SELECT SUM(work_score) SELECT SUM(work_score)
@ -907,14 +907,14 @@ module CoursesHelper
FROM members FROM members
JOIN students_for_courses JOIN students_for_courses
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 3" WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 6"
homework_scores = Member.find_by_sql(sql_select) homework_scores = Member.find_by_sql(sql_select)
end end
def contributor_course_scor(course_id) def contributor_course_scor(course_id)
ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by
(message_num*2 + message_reply_num + news_reply_num + news_num + (message_num*2 + message_reply_num + news_reply_num + news_num +
resource_num*5 + journal_num + homework_journal_num ) desc limit 3;") resource_num*5 + journal_num + homework_journal_num ) desc limit 6;")
end end
#用户在该课程是否具有某个角色 #用户在该课程是否具有某个角色