|
|
|
@ -146,11 +146,11 @@ class CourseMember < ApplicationRecord
|
|
|
|
|
def member_teachers
|
|
|
|
|
teacher_groups = course.teacher_course_groups
|
|
|
|
|
if teacher_groups.count > 0
|
|
|
|
|
member_ids = teacher_groups.where(course_group_id: self.try(:course_group_id)).pluck(:course_member_id)
|
|
|
|
|
member_ids = teacher_groups.where(course_group_id: self.try(:course_group_id)).pluck(:course_member_id).compact
|
|
|
|
|
|
|
|
|
|
none_group_teachers = teacher_groups.pluck(:course_member_id).size > 0 ? teacher_groups.pluck(:course_member_id).join(',') : -1
|
|
|
|
|
teachers = course.teachers.where("members.id not in (#{none_group_teachers}) or
|
|
|
|
|
members.id in (#{member_ids.size > 0 ? member_ids.join(',') : -1})")
|
|
|
|
|
none_group_teachers = teacher_groups.pluck(:course_member_id).size > 0 ? teacher_groups.pluck(:course_member_id).compact.join(',') : -1
|
|
|
|
|
teachers = course.teachers.where("course_members.id not in (#{none_group_teachers}) or
|
|
|
|
|
course_members.id in (#{member_ids.size > 0 ? member_ids.join(',') : -1})")
|
|
|
|
|
else
|
|
|
|
|
teachers = course.teachers
|
|
|
|
|
end
|
|
|
|
|