|
|
|
@ -159,7 +159,7 @@ class SubjectsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def choose_subject_shixun
|
|
|
|
|
@search = params[:search]
|
|
|
|
|
@search = params[:search].strip if params[:search]
|
|
|
|
|
@type = params[:type]
|
|
|
|
|
# 超级管理员用户显示所有未隐藏的实训、非管理员显示合作团队用户的实训(对本单位公开且未隐藏)
|
|
|
|
|
if current_user.admin?
|
|
|
|
@ -173,8 +173,9 @@ class SubjectsController < ApplicationController
|
|
|
|
|
tag_ids = @shixuns.joins(:shixun_tag_repertoires).pluck(:tag_repertoire_id).uniq
|
|
|
|
|
@tags = TagRepertoire.select([:id, :name]).where(id: tag_ids)
|
|
|
|
|
|
|
|
|
|
if params[:search]
|
|
|
|
|
@shixuns = @shixuns.where("name like ?", "%#{@search}%")
|
|
|
|
|
unless params[:search].blank?
|
|
|
|
|
@shixuns = @shixuns.joins(:user).where("shixuns.name like ? or concat(users.lastname, users.firstname) like ?",
|
|
|
|
|
"%#{@search}%", "%#{@search}%").distinct
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
unless @type.nil? || @type == "" || @type == "all"
|
|
|
|
|