|
|
|
@ -251,16 +251,14 @@ module ExercisesHelper
|
|
|
|
|
|
|
|
|
|
#获取试卷的已答/未答人数
|
|
|
|
|
def get_exercise_answers(ex_users)
|
|
|
|
|
@commit_ex_users = ex_users.commit_exercise_by_status(1) #当前老师的全部学生中已提交的
|
|
|
|
|
|
|
|
|
|
@exercise_answers = @commit_ex_users.present? ? @commit_ex_users.size : 0 #表示已经提交了的用户
|
|
|
|
|
course_all_members_count = ex_users.present? ? ex_users.size : 0
|
|
|
|
|
@exercise_answers = ex_users.commit_exercise_by_status(1).size #表示已经提交了的用户
|
|
|
|
|
course_all_members_count = ex_users.exists? ? ex_users.size : 0
|
|
|
|
|
@exercise_unanswers = (course_all_members_count - @exercise_answers)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def exercise_index_show(exercise,course,is_teacher_or,user)
|
|
|
|
|
# exercise_all_users = exercise.exercise_users
|
|
|
|
|
# lock_icon 0不出现锁,1和2均出现锁。但是1仅表示私有,可点击,2表示私有,且不点击
|
|
|
|
|
# lock_icon 0出现锁,1不出现锁
|
|
|
|
|
ex_show_text = []
|
|
|
|
|
|
|
|
|
|
if course.is_end #课堂停止后,试卷显示为已结束
|
|
|
|
@ -290,7 +288,7 @@ module ExercisesHelper
|
|
|
|
|
exercise_publish_time = ex_pb_time[:publish_time]
|
|
|
|
|
exercise_end_time = ex_pb_time[:end_time]
|
|
|
|
|
current_status = 3
|
|
|
|
|
lock_icon = 1
|
|
|
|
|
lock_icon = 0
|
|
|
|
|
if exercise_status == 1
|
|
|
|
|
ex_show_text.push("未发布")
|
|
|
|
|
elsif exercise_status == 3
|
|
|
|
@ -304,7 +302,7 @@ module ExercisesHelper
|
|
|
|
|
exercise_publish_time = ex_pb_time[:publish_time]
|
|
|
|
|
exercise_end_time = ex_pb_time[:end_time]
|
|
|
|
|
current_status = exercise.check_user_answer_status(user)
|
|
|
|
|
lock_icon = 1
|
|
|
|
|
lock_icon = 0
|
|
|
|
|
if current_status == 4
|
|
|
|
|
ex_show_text.push("未提交")
|
|
|
|
|
end
|
|
|
|
@ -316,18 +314,18 @@ module ExercisesHelper
|
|
|
|
|
unreview_count = nil
|
|
|
|
|
if exercise.is_public
|
|
|
|
|
current_status = exercise.check_user_answer_status(user)
|
|
|
|
|
lock_icon = 0 #不出现锁
|
|
|
|
|
lock_icon = 1 #不出现锁
|
|
|
|
|
if current_status == 4
|
|
|
|
|
ex_show_text.push("未提交")
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
current_status = 4
|
|
|
|
|
lock_icon = 2
|
|
|
|
|
lock_icon = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if (course.is_public == 1) && exercise.is_public
|
|
|
|
|
lock_icon = 0
|
|
|
|
|
lock_icon = 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if exercise_status > 1
|
|
|
|
@ -336,7 +334,7 @@ module ExercisesHelper
|
|
|
|
|
show_unreview_count = nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if exercise_status == 2 && exercise_end_time.present?
|
|
|
|
|
if exercise_status == 2 && exercise_end_time.exists?
|
|
|
|
|
ex_left_time = how_much_time(exercise_end_time)
|
|
|
|
|
else #已截止后不显示时间
|
|
|
|
|
ex_left_time = nil
|
|
|
|
@ -725,8 +723,8 @@ module ExercisesHelper
|
|
|
|
|
if ex_time > 0
|
|
|
|
|
exercise_user = exercise.exercise_users.find_by(user_id:user.id)
|
|
|
|
|
time_mill = ex_time * 60 #转为秒
|
|
|
|
|
exercise_end_time = exercise.end_time.present? ? exercise.end_time.to_i : 0
|
|
|
|
|
exercise_user_start = exercise_user&.start_at.present? ? exercise_user.start_at.to_i : 0
|
|
|
|
|
exercise_end_time = exercise.end_time.exists? ? exercise.end_time.to_i : 0
|
|
|
|
|
exercise_user_start = exercise_user&.start_at.exists? ? exercise_user.start_at.to_i : 0
|
|
|
|
|
#用户未开始答题时,即exercise_user_start为0
|
|
|
|
|
if exercise_user_start == 0
|
|
|
|
|
if (exercise_end_time - time_now_i) > time_mill
|
|
|
|
|