|
|
@ -44,8 +44,8 @@ class Poll < ApplicationRecord
|
|
|
|
if unified_setting #试卷统一设置
|
|
|
|
if unified_setting #试卷统一设置
|
|
|
|
poll_users
|
|
|
|
poll_users
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ex_group_setting_ids = poll_group_settings.poll_group_published.pluck(:course_group_id)
|
|
|
|
ex_group_setting_ids = poll_group_settings.poll_group_published.select(:course_group_id).pluck(:course_group_id)
|
|
|
|
poll_users.where(user_id: course.students.where(course_group_id:ex_group_setting_ids).pluck(:user_id).uniq)
|
|
|
|
poll_users.where(user_id: course.students.where(course_group_id:ex_group_setting_ids).select(:user_id).pluck(:user_id).uniq)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -63,15 +63,16 @@ class Poll < ApplicationRecord
|
|
|
|
def poll_published_ids(user_id)
|
|
|
|
def poll_published_ids(user_id)
|
|
|
|
current_user_groups = course.teacher_course_ids(user_id)
|
|
|
|
current_user_groups = course.teacher_course_ids(user_id)
|
|
|
|
if unified_setting
|
|
|
|
if unified_setting
|
|
|
|
if course.none_group_count > 0 #有未分班的,则发布到未发布
|
|
|
|
current_user_groups.uniq
|
|
|
|
un_group_ids = [0]
|
|
|
|
# if course.none_group_count > 0 #有未分班的,则发布到未发布
|
|
|
|
else
|
|
|
|
# un_group_ids = [0]
|
|
|
|
un_group_ids = []
|
|
|
|
# else
|
|
|
|
end
|
|
|
|
# un_group_ids = []
|
|
|
|
(current_user_groups + un_group_ids).uniq #统一设置时,为当前用户的分班id
|
|
|
|
# end
|
|
|
|
|
|
|
|
# (current_user_groups + un_group_ids).uniq #统一设置时,为当前用户的分班id
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ex_group_setting = poll_group_settings.select(:course_group_id).pluck("course_group_id").uniq
|
|
|
|
ex_group_setting = poll_group_settings.select(:course_group_id).pluck("course_group_id").uniq
|
|
|
|
ex_group_setting & current_user_groups #当前用户有权限的已发布的分班id #非统一设置时,为当前用户有权限的且已发布分班的id
|
|
|
|
(ex_group_setting & current_user_groups).uniq #当前用户有权限的已发布的分班id #非统一设置时,为当前用户有权限的且已发布分班的id
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|