dev_forum
SylorHuang 5 years ago
parent b1e13758d3
commit 1cbd20b57a

@ -961,6 +961,8 @@ class PollsController < ApplicationController
@poll_users_list = @poll.all_poll_users(current_user.id) #该老师分班的全部学生 @poll_users_list = @poll.all_poll_users(current_user.id) #该老师分班的全部学生
get_poll_answers(@poll_users_list) get_poll_answers(@poll_users_list)
logger.info("#######F__________@poll_users_list________________####{@poll_users_list.pluck(:id)}") logger.info("#######F__________@poll_users_list________________####{@poll_users_list.pluck(:id)}")
logger.info("#######F__________@users_ids________________####{PollUser.where(id:@poll_users_list.pluck(:id)).pluck(:user_id)}")
if @poll_list_status == 1 if @poll_list_status == 1
@poll_course_groups =[] @poll_course_groups =[]

@ -52,12 +52,12 @@ class Poll < ApplicationRecord
# 统一设置,为当前老师有权限的分班学生,分班设置,也为当前老师有权限的分班的学生 # 统一设置,为当前老师有权限的分班学生,分班设置,也为当前老师有权限的分班的学生
def all_poll_users(user_id) def all_poll_users(user_id)
poll_users = self.poll_users poll_all_users = poll_users
group_ids = poll_published_ids(user_id) group_ids = poll_published_ids(user_id)
if group_ids.present? if group_ids.present?
poll_users = poll_users.where(user_id: course.students.where(course_group_id: group_ids).pluck(:user_id)) poll_all_users = poll_all_users.where(user_id: course.students.where(course_group_id: group_ids).pluck(:user_id).uniq)
end end
poll_users poll_all_users
end end
#当前用户已发布的班级id和试卷分组已发布的班级id的交集 #当前用户已发布的班级id和试卷分组已发布的班级id的交集

Loading…
Cancel
Save