创建战队时搜索用户限制在20个

dev_aliyun
cxt 5 years ago
parent 217eb50590
commit 7b19036cb4

@ -51,7 +51,7 @@ class CompetitionTeamsController < ApplicationController
end
condition = "%#{params[:search].strip}%".gsub(" ","")
@teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0")
@teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0").limit(20)
end
def search_non_user
@ -71,7 +71,7 @@ class CompetitionTeamsController < ApplicationController
end
user_ids = user_ids.length > 0 ? "(" + user_ids.uniq.join(',') + ")" : "(-1)"
condition = "%#{params[:search].strip}%".gsub(" ","")
@users = User.joins(:user_extensions).where("users.id not in #{user_ids} and status = 1 and user_extensions.identity = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}'")
@users = User.joins(:user_extensions).where("users.id not in #{user_ids} and status = 1 and user_extensions.identity = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}'").limit(20)
end
def create

Loading…
Cancel
Save