|
|
|
@ -78,7 +78,7 @@ class HomeworkCommon < ApplicationRecord
|
|
|
|
|
# 根据是否统一发布获取作业的作品列表
|
|
|
|
|
def all_works
|
|
|
|
|
student_works = self.unified_setting ? self.student_works :
|
|
|
|
|
self.student_works.joins("join course_members cm on student_works.user_id=cm.user_id").
|
|
|
|
|
self.student_works.joins("join course_members on student_works.user_id=course_members.user_id").
|
|
|
|
|
where(course_members: {course_group_id: self.published_settings.pluck(:course_group_id)})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ class HomeworkCommon < ApplicationRecord
|
|
|
|
|
# 有分班权限的统计管理的分班且已发布的学生情况
|
|
|
|
|
if member.present? && teacher_course_groups.size > 0
|
|
|
|
|
group_ids = teacher_course_groups.pluck(:course_group_id)
|
|
|
|
|
all_student_works = all_student_works.joins("join course_members cm on student_works.user_id=cm.user_id").
|
|
|
|
|
all_student_works = all_student_works.joins("join course_members course_members on student_works.user_id=course_members.user_id").
|
|
|
|
|
where(course_members: {course_group_id: group_ids})
|
|
|
|
|
end
|
|
|
|
|
all_student_works
|
|
|
|
|