|
|
|
@ -114,27 +114,6 @@ class Exercise < ApplicationRecord
|
|
|
|
|
else
|
|
|
|
|
status = exercise_status #当为老师的时候,则为试卷的总状态
|
|
|
|
|
end
|
|
|
|
|
# if user_group.present?
|
|
|
|
|
# if user_group.role == "STUDENT" #为学生
|
|
|
|
|
# is_teacher = false
|
|
|
|
|
# else
|
|
|
|
|
# is_teacher = true
|
|
|
|
|
# end
|
|
|
|
|
# ex_time = get_exercise_times(user_id,is_teacher)
|
|
|
|
|
#
|
|
|
|
|
# pb_time = ex_time[:publish_time]
|
|
|
|
|
# ed_time = ex_time[:end_time]
|
|
|
|
|
#
|
|
|
|
|
# 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
|
|
|
|
|
# else
|
|
|
|
|
# status = 1
|
|
|
|
|
# end
|
|
|
|
|
# else
|
|
|
|
|
# status = exercise_status
|
|
|
|
|
# end
|
|
|
|
|
status
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -149,26 +128,6 @@ class Exercise < ApplicationRecord
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
ex_group_setting = exercise_group_settings
|
|
|
|
|
# if teacher #当前为老师,为设置组的最大值和最小值
|
|
|
|
|
# user_group = course.teacher_course_groups.get_user_groups(user_id)
|
|
|
|
|
# user_group_ids = user_group.present? ? user_group.pluck(:course_group_id) : course.course_groups.pluck(:id)
|
|
|
|
|
# user_ex_group_settings = ex_group_setting.find_in_exercise_group("course_group_id",user_group_ids)
|
|
|
|
|
# pb_time_min = user_ex_group_settings.publish_time_no_null.map(&:publish_time)
|
|
|
|
|
# en_time_max = user_ex_group_settings.end_time_no_null.map(&:end_time)
|
|
|
|
|
# pb_time = pb_time_min.size > 0 ? pb_time_min.min : nil
|
|
|
|
|
# en_time = en_time_max.size > 0 ? en_time_max.max : nil
|
|
|
|
|
# else
|
|
|
|
|
# user_group = course.students.course_find_by_ids("user_id",user_id)
|
|
|
|
|
# if user_group.present?
|
|
|
|
|
# user_group_id = user_group.first.course_group_id
|
|
|
|
|
# user_ex_group_setting = ex_group_setting.find_in_exercise_group("course_group_id",user_group_id)
|
|
|
|
|
# pb_time = user_ex_group_setting.present? ? user_ex_group_setting.first.publish_time : nil
|
|
|
|
|
# en_time = user_ex_group_setting.present? ? user_ex_group_setting.first.end_time : nil
|
|
|
|
|
# else
|
|
|
|
|
# pb_time = nil
|
|
|
|
|
# en_time = nil
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
user_group = course.students.course_find_by_ids("user_id",user_id)
|
|
|
|
|
if user_group.present?
|
|
|
|
|
user_group_id = user_group.first.course_group_id
|
|
|
|
|