|
|
|
@ -69,11 +69,7 @@ class Exercise < ApplicationRecord
|
|
|
|
|
def common_published_ids(user_id)
|
|
|
|
|
current_user_groups = course.teacher_course_ids(user_id)
|
|
|
|
|
if unified_setting
|
|
|
|
|
if course.none_group_count > 0 #有未分班的,则发布到未发布分班
|
|
|
|
|
un_group_ids = [0]
|
|
|
|
|
else
|
|
|
|
|
un_group_ids = []
|
|
|
|
|
end
|
|
|
|
|
un_group_ids = (course.none_group_count > 0) ? [0] : []
|
|
|
|
|
published_group_ids = (current_user_groups + un_group_ids).uniq #统一设置时,为当前用户的分班id及未分班
|
|
|
|
|
else
|
|
|
|
|
ex_group_setting = exercise_group_settings.pluck("course_group_id").uniq
|
|
|
|
@ -89,11 +85,7 @@ class Exercise < ApplicationRecord
|
|
|
|
|
ex_group_settings = exercise_group_settings.pluck(:course_group_id)
|
|
|
|
|
member = course.course_members.course_find_by_ids("user_id",user_id)
|
|
|
|
|
member_group_id = member.pluck(:course_group_id).uniq
|
|
|
|
|
if (member_group_id & ex_group_settings).size > 0 || user_identity < Course::STUDENT
|
|
|
|
|
true
|
|
|
|
|
else
|
|
|
|
|
false
|
|
|
|
|
end
|
|
|
|
|
((member_group_id & ex_group_settings).size > 0 || user_identity < Course::STUDENT) ? true : false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#判断是否为分班,如果分班,试卷的截止时间为当前分班时间,否则为试卷的截止时间
|
|
|
|
|