|
|
@ -146,7 +146,7 @@ class Course < ApplicationRecord
|
|
|
|
def teacher_group(user_id)
|
|
|
|
def teacher_group(user_id)
|
|
|
|
data =
|
|
|
|
data =
|
|
|
|
if teacher_course_groups.exists?(user_id: user_id)
|
|
|
|
if teacher_course_groups.exists?(user_id: user_id)
|
|
|
|
teacher_course_groups.joins(:course_group).where(user_id: user_id)
|
|
|
|
teacher_course_groups.joins(:course_group).where(user_id: user_id).distinct
|
|
|
|
.pluck('course_groups.id', 'course_groups.name')
|
|
|
|
.pluck('course_groups.id', 'course_groups.name')
|
|
|
|
else
|
|
|
|
else
|
|
|
|
course_groups.pluck(:id, :name)
|
|
|
|
course_groups.pluck(:id, :name)
|
|
|
|