diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 6a8edee71..d928d1df5 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -1005,12 +1005,6 @@ class PollsController < ApplicationController if @poll_users_list.present? && @poll_users_list.count > 0 - if order == "student_id" - @poll_users_list = @poll_users_list.joins(user: [:user_extension]).order("user_extensions.student_id DESC") - else - @poll_users_list = @poll_users_list.order("end_at DESC") - end - #答题状态的选择 if choose_type.present? @poll_users_list = @poll_users_list.commit_by_status(choose_type) @@ -1027,8 +1021,12 @@ class PollsController < ApplicationController 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(:user_id)}") + if order == "student_id" + @poll_users_list = @poll_users_list.joins(user: :user_extension).order("user_extensions.student_id DESC") + else + @poll_users_list = @poll_users_list.order("end_at DESC") + end + logger.info("#######user_id: ####{@poll_users_list.pluck(:user_id).sort}") @poll_users_size = @poll_users_list.count @@ -1036,7 +1034,7 @@ class PollsController < ApplicationController 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(:user_id)}") + logger.info("#####page_user: #{@poll_users_list.pluck(:user_id).sort}") else @poll_users_list = [] @poll_users_size = 0