json.work_users @work_list do |work|
  json.work_id work.id
  json.user_name work.user&.real_name
  json.student_id work.user&.student_id
  json.course_group_name @students.select{|member| member.user_id == work.user_id}.first.try(:course_group_name)
  if @comment_status.to_i == 2
    json.cross_teachers work.work_cross_teachers
    json.cross_teacher_ids work.work_cross_teacher_ids
  elsif @comment_status.to_i == 4
    json.cross_groups work.work_cross_groups
    json.cross_group_ids work.work_cross_group_ids
  end
end

json.user_count @user_count

json.course_groups @course_groups do |group|
  json.(group, :id, :name)
end

if @comment_status.to_i == 2
  json.teachers @course.teachers.includes(:user) do |teacher|
    json.user_id teacher.user_id
    json.user_name teacher.user&.real_name
  end
elsif @comment_status.to_i == 4
  json.graduation_groups @course.graduation_groups do |group|
    json.(group, :id, :name)
  end
end