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/exercises/exercise_lists.json.jbuilder

52 lines
2.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

json.exercise_types do
if @exercise_current_user_status == 0 #当为老师的时候,显示的全部人数
json.published_count @exercise_publish_count
json.unpublish_count @exercise_unpublish_count
json.exercise_all_users @exercise_users_count #全部显示的人数
json.total_users @exercise_users_size #全部人数
json.review_counts @teacher_review_count #已评阅人数git
json.unreview_counts @teacher_unreview_count #未评阅人数
end
json.score_open @exercise.score_open #成绩是否公开
json.exercise_status @exercise_status #试卷的状态
json.answer_users @exercise_answers
json.unanswer_users @exercise_unanswers
json.user_permission @exercise_current_user_status #当前用户存在且为课堂教师/管理员/超级管理员时为0 其他否则为1
json.exercise_id @exercise.id
json.subjective @subjective_type #是否包含主观题1为包括0为不包括
json.exercise_end_time ((@ex_user_end_time.nil? || @ex_user_end_time < Time.now) ? "--" : how_much_time(@ex_user_end_time))
json.groups_count @c_group_counts
end
if @exercise_current_user_status == 0 #当为老师的时候
if @exercise_course_groups.present?
json.course_groups do
json.array! @exercise_course_groups do |group|
json.exercise_group_id group[:course_id] #班级id
json.exercise_group_name group[:course_name] #班级名称
json.exercise_group_students group[:student_count] #班级人数
end
end
else
json.course_groups []
end
end
if @current_user_ex_answers.present?
json.current_answer_user do
json.partial! "exercises/exercise_user",locals: {exercise_user:@current_user_ex_answers.first, subjective_type:@subjective_type,
user_status:@exercise_current_user_status, exercise:@exercise}
end
end
if @exercise_users_list.present?
json.exercise_users do
json.array! @exercise_users_list.each do |exercise_user|
json.partial! "exercises/exercise_user",locals: {exercise_user:exercise_user, subjective_type:@subjective_type,
user_status:@exercise_current_user_status, exercise:@exercise}
end
end
else
json.exercise_users []
end