You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/courses/teachers.json.jbuilder

31 lines
1.3 KiB

json.teacher_list do
json.array! @teacher_list do |teacher|
json.course_member_id teacher.id
json.name teacher.user.real_name
json.name_link user_path(teacher.user)
json.login teacher.user.login
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
end
end
json.graduation_group teacher.graduation_group.try(:name)
json.graduation_group_id teacher.graduation_group.try(:id)
end
end
json.teacher_list_size @teacher_list_size
json.application_list do
json.array! @applications do |application|
json.application_id application.id
json.user_id application.course_message_id
json.name application.application_user.real_name
json.name_link user_path(application.application_user)
json.login application.application_user.login
json.role application.content.to_i == 3 || application.content.to_i == 7 ? "助教" : application.content.to_i == 2 || application.content.to_i == 9 ? "教师" : ""
end
end
json.is_admin @is_admin