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/graduation_tasks/tasks_list.json.jbuilder

59 lines
2.4 KiB

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
# 课程发布才有数据
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?
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 work.class_grouping_name
if @task.have_grouping?
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)
json.cross_comment_score work.cross_comment_score(@current_user, @user_course_identity)
json.final_score work_final_score work, @current_user, @user_course_identity
json.assign work.assign_power?(@user_course_identity)
end
end
end