diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 8286a96e2..61c5c8eab 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -127,7 +127,7 @@ class Exercise < ApplicationRecord #判断是否为分班,如果分班,试卷的截止时间为当前分班时间,否则为试卷的截止时间 def get_exercise_status(user) - if course.end_time.present? && course.end_time <= Time.now + if course.end_date.present? && course.end_date <= Time.now status = 4 else if user.present? && user.student_of_course?(course) #当为学生的时候,需根据分班来判断试卷状态 diff --git a/app/models/poll.rb b/app/models/poll.rb index 5fda30609..a9b4c2984 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -99,17 +99,15 @@ class Poll < ApplicationRecord end end - def get_poll_status(user) - if course.end_time.present? && course.end_time <= Time.now + def get_poll_status(user)s + if course.end_date.present? && course.end_date <= Time.now status = 4 else if user.present? && user.student_of_course?(course) ex_time = get_poll_times(user_id,false) pb_time = ex_time[:publish_time] ed_time = ex_time[:end_time] - if course.end_time.present? && course.end_time <= Time.now - status = 4 - elsif pb_time.present? && ed_time.present? && pb_time <= Time.now && ed_time > Time.now + if pb_time.present? && ed_time.present? && pb_time <= Time.now && ed_time > Time.now status = 2 elsif ed_time.present? && ed_time <= Time.now status = 3