|
|
|
@ -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
|
|
|
|
|