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

46 lines
2.1 KiB

6 years ago
if @exercises_count > 0
json.exercises do
json.array! @exercises do |exercise|
6 years ago
json.extract! exercise, :id, :exercise_name,:is_public,:created_at
if @is_teacher_or == 2
6 years ago
second_left = get_exercise_left_time(exercise,@current_user_)
json.time second_left.present? ? (second_left / 60) : nil
6 years ago
end
ex_index = exercise_index_show(exercise,@course,@is_teacher_or,@current_user_)
6 years ago
json.exercise_status ex_index[:ex_status]
json.lock_status ex_index[:lock_icon]
json.publish_time ex_index[:publish_time] # 试卷的发布时间
json.end_time ex_index[:end_time] # 试卷的截止时间
json.exercise_answer ex_index[:exercise_answer] # 已提交试卷的用户
json.exercise_unanswer ex_index[:exercise_unanswer] # 已查看试卷/开始答题,但是未提交试卷的用户
json.exercise_left_time ex_index[:ex_left_time]
json.current_status ex_index[:current_status] #答题的状态
json.unreview_count ex_index[:unreview_count]
json.exercise_tips ex_index[:ex_tips]
end
end
else
json.exercises []
end
6 years ago
json.course_types do
json.course_status @course.is_end ? 1 : 0 #课堂的当前是否结束如结束则为1否则为0
json.course_end_time @course.end_date #课堂的截止时间
json.course_is_public @course.is_public #判断课堂是否为公开,只有公开课才有设为公开的按钮
json.user_permission @is_teacher_or # 当前用户存在且为课堂教师/管理员/超级管理员时为1 课堂成员为2否则为0
end
json.exercises_counts do
json.exercises_total_counts @exercises_count #全部试卷数
json.exercises_all_counts @exercises_select_count #选择后的全部试卷数
json.exercises_unpublish_counts @exercises_unpublish_counts #未发布试卷数
json.exercises_published_counts @exercises_published_counts #已发布试卷数
json.exercises_ended_counts @exercises_ended_counts #已截止试卷数
json.left_banner_id @left_banner_id
json.left_banner_name @left_banner_name
end