导入历史课堂的学生api调整

dev_course
cxt 6 years ago
parent 3796fa40e7
commit bdc43fb9ce

@ -737,11 +737,13 @@ class CoursesController < ApplicationController
end
end
# 获取历史课堂,即用户管理的所有课堂以及课堂下的分班
# 获取历史课堂,即用户管理的所有课堂以及课堂下的分班(去除当前课堂)
def get_historical_courses
user_id = current_user.id
@courses = Course.includes(:course_groups).where(tea_id: user_id, is_delete: 0)
@courses = Course.where.not(id: @course.id).joins(:course_members).
where(is_delete: 0, course_members: {user_id: current_user.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR]}).includes(:course_groups)
# @courses = Course.includes(:course_groups).where(id: current_user.course_members, is_delete: 0)
end
# 根据历史课堂的课堂id和分班id获取所有学生

@ -1,6 +1,6 @@
json.students do
json.array! @students do |student|
json.course_member_id student.id
json.user_id student.user_id
json.name student.user.real_name
json.student_id student.user.user_extension.try(:student_id)
json.school_name student.user.user_extension.school.try(:name)

Loading…
Cancel
Save