dev_course
cxt 5 years ago
parent 88f9dbc68e
commit 383723612d

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

Loading…
Cancel
Save