From 281a49a8b0175e6bdedebcc769fd7c96e7a0947c Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 6 Jul 2019 17:16:29 +0800 Subject: [PATCH] fixbug --- app/helpers/exercises_helper.rb | 2 +- app/models/exercise.rb | 2 +- app/models/poll.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index ca2f6d47c..3bc342c06 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -511,7 +511,7 @@ module ExercisesHelper exercise_user_id = ex_user_user.id ex_user_exercise_status = exercise.get_exercise_status(ex_user_user) ex_user_student_id = ex_user_user.student_id - if ex_user.start_at.present? && ex_user.commit_status == 0 #用户已回答,但未提交 + if ex_user.start_at.present? && (ex_user.commit_status == 0) #用户已回答,但未提交 commit_status = 2 #继续答题 else commit_status = ex_user.commit_status diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 150988a49..606132c27 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -142,7 +142,7 @@ class Exercise < ApplicationRecord user_ex_status = get_exercise_status(user) user_status = 2 if ex_answer_user.exists? && (ex_answer_user.first&.start_at.present? || ex_answer_user.first&.end_at.present?) #学生有过答题的,或者立即截止,但学生未做试卷的 - user_status = ex_answer_user.commit_status + user_status = ex_answer_user.first.commit_status end if ex_answer_user.exists? && ex_answer_user.first&.start_at.blank? && user_ex_status == 3 user_status = 4 diff --git a/app/models/poll.rb b/app/models/poll.rb index ed3c143fa..a055fd656 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -122,7 +122,7 @@ class Poll < ApplicationRecord poll_answer_user = poll_users.where(user_id: user.id).select(:start_at,:end_at,:commit_status) user_status = 2 if poll_answer_user.exists? && (poll_answer_user.first&.start_at.present? || poll_answer_user.first&.end_at.present?) #学生有过答题的,或者立即截止,但学生未做试卷的 - user_status = poll_answer_user.commit_status + user_status = poll_answer_user.first.commit_status end user_status end