diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index fe29497d0..8174d1eea 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -723,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.exists? ? exercise.end_time.to_i : 0 - exercise_user_start = exercise_user&.start_at.exists? ? exercise_user.start_at.to_i : 0 + 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_user_start为0 if exercise_user_start == 0 if (exercise_end_time - time_now_i) > time_mill