json.partial! "public_navigation", locals: {graduation: @task, course: @course}
json.user_course_identity @user_course_identity
json.course_group_count @course.course_groups_count
json.cross_comment @task.cross_comment
json.comment_status @task.comment_status
# 课程发布才有数据
if @task.published? || @user_course_identity < Course::STUDENT
# 老师身份才有的分类信息
  if @user_course_identity < Course::STUDENT
    json.search_assistants do
      json.teacher_comment teacher_comment @task, @current_user.id
      json.task_status task_status @task, @current_user.id
      json.course_group_info course_group_info @course, @current_user.id
      json.cross_comment cross_comment @task, @current_user
    end
    # 课堂下所有老师 TODO: 考虑以后在点击分配时，再获取老师列表
    json.teacher_list do
      json.array! @teachers do |teacher|
        json.id teacher.user.id
        json.name teacher.user.full_name
      end
    end
  elsif @user_course_identity == Course::STUDENT
    json.work_id @task.user_work(@current_user.id).try(:id)
    json.work_status graduation_work_status(@task, @current_user.id, @course)
  end

  # 是否具有分组
  json.have_grouping @task.have_grouping?
  # 是否关联项目
  json.have_project @task.have_grouping? && @task.base_on_project

  if @user_course_identity == Course::STUDENT
    json.commit_count grduationwork_count @task, 1
    json.uncommit_count grduationwork_count @task, 0
    json.left_time task_left_time @task
  else
    json.work_count @work_count
    json.all_work_count @all_work_count
  end

# 学生数据
  json.work_lists do
    json.array! @work_list do |work|
      json.id work.id
      json.user_id work.user.id
      json.name work.user.real_name
      json.student_id work.user.student_id
      json.class_grouping_name @students.select{|student| student.user_id == work.user_id}.first.try(:course_group_name)
      json.ultimate_score work.ultimate_score
      if @task.have_grouping?
        json.is_leader work.user_id == work.commit_user_id
        json.grouping_name work.grouping_name
        if @task.base_on_project
          json.project_info project_info work, @current_user, @user_course_identity
        end
      end
      json.status work.work_status
      json.update_time format_time work.update_time
      json.teacher_comment_score work.teacher_comment_score(@current_user, @user_course_identity)
      if @task.cross_comment
        json.cross_comment_score work.cross_comment_score(@current_user, @user_course_identity)
        json.cross_comment_num work.cross_comment_num
      end
      json.late_penalty work.late_penalty if @task.allow_late
      json.final_score work_final_score work, @current_user, @user_course_identity
      json.assign @assign_power
      json.view_work @view_work || (@current_user.id == work.user_id && work.work_status != 0)
    end
  end
end