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