Merge pull request #3735 from aignatov-bio/ai-sci-6344-optimize-my-modules-tags-search

Update query for search tags [SCI-6344]
This commit is contained in:
Alex Kriuchykhin 2021-12-10 14:35:17 +01:00 committed by GitHub
commit 31d12bc739
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,10 +114,10 @@ class MyModuleTagsController < ApplicationController
end
def search_tags
assigned_tags = @my_module.my_module_tags.pluck(:tag_id)
assigned_tags = @my_module.my_module_tags.select(:tag_id)
all_tags = @my_module.experiment.project.tags
tags = all_tags.where.not(id: assigned_tags)
.search(current_user, false, params[:query])
.where_attributes_like(:name, params[:query])
.select(:id, :name, :color)
.limit(6)