diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 55ade6e7c..6e3ef835e 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -260,6 +260,7 @@ module ExercisesHelper def exercise_index_show(exercise,course,is_teacher_or,user) # exercise_all_users = exercise.exercise_users + # lock_icon 0不出现锁,1和2均出现锁。但是1仅表示私有,可点击,2表示私有,且不点击 ex_show_text = [] if course.is_end #课堂停止后,试卷显示为已结束 @@ -280,6 +281,7 @@ module ExercisesHelper else ex_show_text end + if is_teacher_or == 1 exercise_users_list = exercise.all_exercise_users(user.id) #当前老师所在班级的全部学生 unreview_count = exercise_users_list.exercise_unreview.size @@ -288,7 +290,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 = 1 if exercise_status == 1 ex_show_text.push("未发布") elsif exercise_status == 3 @@ -302,7 +304,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 = 1 if current_status == 4 ex_show_text.push("未提交") end @@ -314,16 +316,20 @@ module ExercisesHelper unreview_count = nil if exercise.is_public current_status = exercise.check_user_answer_status(user) - lock_icon = 1 #非课堂成员,但是试卷为公开的,不加锁 + lock_icon = 0 #不出现锁 if current_status == 4 ex_show_text.push("未提交") end else current_status = 4 - lock_icon = 0 #显示锁图标 + lock_icon = 2 end end + if (course.is_public == 1) && exercise.is_public + lock_icon = 0 + end + if exercise_status > 1 show_unreview_count = unreview_count else @@ -332,8 +338,6 @@ module ExercisesHelper if exercise_status == 2 && exercise_end_time.present? ex_left_time = how_much_time(exercise_end_time) - # elsif exercise_status == 3 && course.end_date.present? - # ex_left_time = how_much_time(course.end_date.to_time) else #已截止后不显示时间 ex_left_time = nil end