From 857f2dcb3e169d27fcf804e919b0f3ac66d2ee55 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 2 Jul 2019 14:43:56 +0800 Subject: [PATCH] fix bug --- app/controllers/exercises_controller.rb | 2 +- app/controllers/polls_controller.rb | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 2761523a6..a793c673c 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1238,7 +1238,7 @@ class ExercisesController < ApplicationController @teacher_unreview_count = 0 #筛选/分类,排序 order = params[:order] - if @exercise_users_list.present? && @exercise_users_list.count > 0 + if @exercise_users_list.present? && @exercise_users_list.size > 0 teacher_reviews = @exercise_users_list.exercise_review teacher_unreviews = @exercise_users_list.exercise_unreview @teacher_review_count = teacher_reviews.count #已评阅 diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 7ac288d7d..6a8edee71 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -953,17 +953,12 @@ class PollsController < ApplicationController @poll_publish_count = get_user_permission_course(poll_ids,2).count @poll_unpublish_count = get_user_permission_course(poll_ids,1).count @course_all_members = @course.students - logger.info("#######F___________poll_user_ids________________####{@poll.poll_users.pluck(:id)}") @poll_group_counts = @course.course_groups_count if @user_course_identity < Course::STUDENT #当前为老师,而且老师只能查看自己班级的/课堂的问卷 @poll_current_user_status = 0 @poll_users_list = @poll.all_poll_users(current_user.id) #该老师分班的全部学生 get_poll_answers(@poll_users_list) - 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 @poll_course_groups =[] else @@ -1033,15 +1028,15 @@ class PollsController < ApplicationController @poll_users_list = @poll_users_list.joins(user: :user_extension).where("CONCAT(lastname, firstname) like ? OR student_id like ?", "%#{search_content}%", "%#{search_content}%") end - logger.info("#######F_______@poll_users_list_last___@users_ids________________####{@poll_users_list.pluck(:id)}") - + logger.info("#######F_______@poll_users_list_last___@users_ids________________####{@poll_users_list.pluck(:user_id)}") @poll_users_size = @poll_users_list.count + # 分页 page = params[:page] || 1 limit = params[:limit] || 20 @poll_users_list = @poll_users_list.page(page).per(limit) - logger.info("#######F_______@poll_users_list_after_page___@users_ids________________####{@poll_users_list.pluck(:id)}") + logger.info("#######F_______@poll_users_list_after_page___@users_ids________________####{@poll_users_list.pluck(:user_id)}") else @poll_users_list = [] @poll_users_size = 0