From 8269367f4737ef49753bfebcb81e4680718cacc6 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 2 Jul 2019 14:21:16 +0800 Subject: [PATCH] fix bug --- app/controllers/polls_controller.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 810bf55c1..7ac288d7d 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -1029,20 +1029,19 @@ class PollsController < ApplicationController end #搜索 - # if search_content.present? - # @poll_users_list = @poll_users_list.joins(user: :user_extension).where("CONCAT(lastname, firstname) like ? OR student_id like ?", "%#{search_content}%", "%#{search_content}%") - # end + if search_content.present? + @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)}") @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) + 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)}") - else @poll_users_list = [] @poll_users_size = 0