作业列表页面已交人数未去掉删除的学生

This commit is contained in:
cxt 2017-07-07 20:49:23 +08:00
parent 5284e6af8b
commit 41fd331f11
1 changed files with 2 additions and 2 deletions

View File

@ -455,7 +455,7 @@ module ApplicationHelper
# 判断作业有多少人提交了
#
def had_commit_studentwork_count homework_common
StudentWork.where("work_status !=? and homework_common_id=?",0, homework_common.id).count
StudentWork.where("work_status !=? and homework_common_id=? and is_delete = 0",0, homework_common.id).count
end
# 未提交作品数统计
@ -465,7 +465,7 @@ module ApplicationHelper
# 未评阅
def had_unevaluate_count homework_common
count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i
count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sw.is_delete = 0 and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i
student_count = homework_common.course.student.count
return student_count - count
end