From b7b5821f939cee7c72717ac01c1f11d60f789dd5 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 6 Jul 2019 10:23:52 +0800 Subject: [PATCH] fixbug --- app/helpers/exercises_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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