|
|
@ -48,6 +48,7 @@ class ExercisesController < ApplicationController
|
|
|
|
@exercises = @exercises_all #老师能看到全部的试卷,不管是已发布的/未发布的/已截止的/统一设置的/私有设置的(看到内容不同)
|
|
|
|
@exercises = @exercises_all #老师能看到全部的试卷,不管是已发布的/未发布的/已截止的/统一设置的/私有设置的(看到内容不同)
|
|
|
|
elsif @user_course_identity == Course::STUDENT # 2为课堂成员,能看到统一设置的和自己班级的
|
|
|
|
elsif @user_course_identity == Course::STUDENT # 2为课堂成员,能看到统一设置的和自己班级的
|
|
|
|
@is_teacher_or = 2
|
|
|
|
@is_teacher_or = 2
|
|
|
|
|
|
|
|
# get_exercise_left_time(@exercise,current_user)
|
|
|
|
member_group_id = @current_student.first.try(:course_group_id).to_i # 成员的分班id,默认为0
|
|
|
|
member_group_id = @current_student.first.try(:course_group_id).to_i # 成员的分班id,默认为0
|
|
|
|
if member_group_id == 0 #表示是课堂的未分班成员,只能查看统一设置的试卷(已发布的/已截止的)
|
|
|
|
if member_group_id == 0 #表示是课堂的未分班成员,只能查看统一设置的试卷(已发布的/已截止的)
|
|
|
|
@exercises = member_show_exercises.present? ? member_show_exercises.unified_setting : []
|
|
|
|
@exercises = member_show_exercises.present? ? member_show_exercises.unified_setting : []
|
|
|
@ -204,10 +205,12 @@ class ExercisesController < ApplicationController
|
|
|
|
@is_teacher_or = 0
|
|
|
|
@is_teacher_or = 0
|
|
|
|
@user_exercise_answer = @exercise.check_user_answer_status(current_user)
|
|
|
|
@user_exercise_answer = @exercise.check_user_answer_status(current_user)
|
|
|
|
@user_commit_counts = 0
|
|
|
|
@user_commit_counts = 0
|
|
|
|
|
|
|
|
get_exercise_left_time(@exercise,current_user)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@is_teacher_or = 1
|
|
|
|
@is_teacher_or = 1
|
|
|
|
@user_exercise_answer = 3 #教师页面
|
|
|
|
@user_exercise_answer = 3 #教师页面
|
|
|
|
@user_commit_counts = @exercise.exercise_users.where(commit_status:1).count #已提交的用户数
|
|
|
|
@user_commit_counts = @exercise.exercise_users.where(commit_status:1).count #已提交的用户数
|
|
|
|
|
|
|
|
@user_left_time = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@ex_status = @exercise.get_exercise_status(current_user.id)
|
|
|
|
@ex_status = @exercise.get_exercise_status(current_user.id)
|
|
|
|
|
|
|
|
|
|
|
@ -222,6 +225,8 @@ class ExercisesController < ApplicationController
|
|
|
|
@exercise_publish_count = 1 #试卷未发布,且课堂没有分班的时候
|
|
|
|
@exercise_publish_count = 1 #试卷未发布,且课堂没有分班的时候
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
tip_exception("没有权限")
|
|
|
|
tip_exception("没有权限")
|
|
|
@ -1016,17 +1021,20 @@ class ExercisesController < ApplicationController
|
|
|
|
@exercise_user_current.update_attribute("start_at",Time.now)
|
|
|
|
@exercise_user_current.update_attribute("start_at",Time.now)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
ex_time = @exercise.time
|
|
|
|
|
|
|
|
if ex_time > 0
|
|
|
|
get_exercise_left_time(@exercise,@exercise_user_current)
|
|
|
|
time_mill = ex_time * 60 #转为秒
|
|
|
|
|
|
|
|
exercise_end_time = @exercise.end_time.present? ? @exercise.end_time.to_i : 0
|
|
|
|
# ex_time = @exercise.time
|
|
|
|
exercise_user_start = @exercise_user_current.present? ? @exercise_user_current.start_at.to_i : 0
|
|
|
|
# if ex_time > 0
|
|
|
|
if (exercise_user_start + time_mill) > exercise_end_time
|
|
|
|
# time_mill = ex_time * 60 #转为秒
|
|
|
|
time_mill = exercise_end_time - exercise_user_start #如果开始答题时间加试卷的限时长大于试卷的截止时间,则以试卷的截止时间到开始答题时间为试卷的限时
|
|
|
|
# exercise_end_time = @exercise.end_time.present? ? @exercise.end_time.to_i : 0
|
|
|
|
end
|
|
|
|
# exercise_user_start = @exercise_user_current.present? ? @exercise_user_current.start_at.to_i : 0
|
|
|
|
exercise_user_left_time = Time.now.to_i - exercise_user_start #用户已回答的时间
|
|
|
|
# if (exercise_user_start + time_mill) > exercise_end_time
|
|
|
|
@user_left_time = (time_mill < exercise_user_left_time) ? nil : (time_mill - exercise_user_left_time) #当前用户对试卷的回答剩余时间
|
|
|
|
# time_mill = exercise_end_time - exercise_user_start #如果开始答题时间加试卷的限时长大于试卷的截止时间,则以试卷的截止时间到开始答题时间为试卷的限时
|
|
|
|
end
|
|
|
|
# end
|
|
|
|
|
|
|
|
# exercise_user_left_time = Time.now.to_i - exercise_user_start #用户已回答的时间
|
|
|
|
|
|
|
|
# @user_left_time = (time_mill < exercise_user_left_time) ? nil : (time_mill - exercise_user_left_time) #当前用户对试卷的回答剩余时间
|
|
|
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
@t_user_exercise_status = @exercise.get_exercise_status(current_user.id)
|
|
|
|
@t_user_exercise_status = @exercise.get_exercise_status(current_user.id)
|
|
|
|
|
|
|
|
|
|
|
@ -1788,4 +1796,6 @@ class ExercisesController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|