diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 5e76d263..06d504b2 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -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