@ -1317,11 +1317,11 @@ module ApplicationHelper
def had_commit_studentwork_count homework_common
def had_commit_studentwork_count homework_common
member = homework_common . course . members . where ( :user_id = > User . current . id ) . first
member = homework_common . course . members . where ( :user_id = > User . current . id ) . first
student_works = homework_common . student_works
student_works = homework_common . student_works
if member . present? && member . teacher_course_groups . count > 0
if member . present? && member . teacher_course_groups . size > 0
group_students = homework_common . course . members . where ( :course_group_id = > member . teacher_course_groups . pluck ( :course_group_id ) ) . map ( & :user_id )
group_students = homework_common . course . members . where ( :course_group_id = > member . teacher_course_groups . pluck ( :course_group_id ) ) . map ( & :user_id )
student_works = student_works . where ( :user_id = > group_students )
student_works = student_works . where ( :user_id = > group_students )
end
end
student_works . where ( " work_status !=? " , 0 ) . count
student_works . where ( " work_status !=? " , 0 ) . size
end
end
# 实训作业的有效作品数
# 实训作业的有效作品数
@ -1357,11 +1357,11 @@ module ApplicationHelper
def had_uncommit_studentwork_count homework_common
def had_uncommit_studentwork_count homework_common
member = homework_common . course . members . where ( :user_id = > User . current . id ) . first
member = homework_common . course . members . where ( :user_id = > User . current . id ) . first
student_works = homework_common . student_works
student_works = homework_common . student_works
if member . present? && member . teacher_course_groups . count > 0
if member . present? && member . teacher_course_groups . size > 0
group_students = homework_common . course . members . where ( :course_group_id = > member . teacher_course_groups . pluck ( :course_group_id ) ) . map ( & :user_id )
group_students = homework_common . course . members . where ( :course_group_id = > member . teacher_course_groups . pluck ( :course_group_id ) ) . map ( & :user_id )
student_works = student_works . where ( :user_id = > group_students )
student_works = student_works . where ( :user_id = > group_students )
end
end
student_works . where ( " work_status =? " , 0 ) . count
student_works . where ( " work_status =? " , 0 ) . size
end
end
# 未评阅
# 未评阅
@ -1369,12 +1369,12 @@ module ApplicationHelper
#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
#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
member = homework_common . course . members . where ( :user_id = > User . current . id ) . first
member = homework_common . course . members . where ( :user_id = > User . current . id ) . first
student_works = homework_common . student_works
student_works = homework_common . student_works
if member . present? && member . teacher_course_groups . count > 0
if member . present? && member . teacher_course_groups . size > 0
group_students = homework_common . course . members . where ( :course_group_id = > member . teacher_course_groups . pluck ( :course_group_id ) ) . map ( & :user_id )
group_students = homework_common . course . members . where ( :course_group_id = > member . teacher_course_groups . pluck ( :course_group_id ) ) . map ( & :user_id )
student_works = student_works . where ( :user_id = > group_students )
student_works = student_works . where ( :user_id = > group_students )
end
end
has_comment = StudentWorksScore . where ( :student_work_id = > student_works . map ( & :id ) , :reviewer_role = > [ 1 , 2 ] ) . group_by ( & :student_work_id ) . count
has_comment = StudentWorksScore . where ( :student_work_id = > student_works . map ( & :id ) , :reviewer_role = > [ 1 , 2 ] ) . group_by ( & :student_work_id ) . size
student_count = student_works . count
student_count = student_works . size
return student_count - has_comment
return student_count - has_comment
end
end