|
|
|
@ -7,9 +7,11 @@ json.teacher_list do
|
|
|
|
|
json.user_id teacher.user.id
|
|
|
|
|
json.role teacher.role == "CREATOR" ? "管理员" : teacher.role == "PROFESSOR" ? "教师" : "助教"
|
|
|
|
|
json.course_groups do
|
|
|
|
|
json.array! CourseGroup.where(id: TeacherCourseGroup.where(course_member_id: teacher.id, user_id: teacher.user.id, course_id: @course.id).pluck(:course_group_id)) do |course_group|
|
|
|
|
|
json.name course_group.name
|
|
|
|
|
json.id course_group.id
|
|
|
|
|
if @course.course_groups_count > 0
|
|
|
|
|
json.array! @course.course_groups.select{|group| teacher.teacher_course_groups.pluck(:course_group_id).include?(group.id)} do |course_group|
|
|
|
|
|
json.name course_group.name
|
|
|
|
|
json.id course_group.id
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
json.graduation_group teacher.graduation_group.try(:name)
|
|
|
|
|