mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
Merge pull request #414 from okriuchykhin/ok_SCI_887
Do not show archived projects, experiments and tasks in smart annotations [SCI-887]
This commit is contained in:
commit
8a220c2351
4 changed files with 15 additions and 7 deletions
|
@ -70,7 +70,7 @@ class Experiment < ActiveRecord::Base
|
|||
.where('experiments.project_id IN (?)', projects_ids)
|
||||
.where_attributes_like([:name], a_query)
|
||||
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
||||
return new_query
|
||||
return include_archived ? new_query : new_query.is_archived(false)
|
||||
elsif include_archived
|
||||
new_query =
|
||||
Experiment
|
||||
|
|
|
@ -76,7 +76,11 @@ class MyModule < ActiveRecord::Base
|
|||
.where('my_modules.experiment_id IN (?)', experiments_ids)
|
||||
.where_attributes_like([:name], a_query)
|
||||
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
||||
return new_query
|
||||
if include_archived
|
||||
return new_query
|
||||
else
|
||||
return new_query.where('my_modules.archived = ?', false)
|
||||
end
|
||||
elsif include_archived
|
||||
new_query = MyModule
|
||||
.distinct
|
||||
|
|
|
@ -54,7 +54,11 @@ class Project < ActiveRecord::Base
|
|||
user.id)
|
||||
.where_attributes_like(:name, a_query)
|
||||
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
||||
return new_query
|
||||
if include_archived
|
||||
return new_query
|
||||
else
|
||||
return new_query.where('projects.archived = ?', false)
|
||||
end
|
||||
else
|
||||
org_ids =
|
||||
Organization
|
||||
|
|
|
@ -13,7 +13,7 @@ class SmartAnnotation
|
|||
def my_modules
|
||||
# Search tasks
|
||||
res = MyModule
|
||||
.search(@current_user, true, @query, 1, @current_organization)
|
||||
.search(@current_user, false, @query, 1, @current_organization)
|
||||
|
||||
modules_list = []
|
||||
res.each do |my_module_res|
|
||||
|
@ -42,7 +42,7 @@ class SmartAnnotation
|
|||
def projects
|
||||
# Search projects
|
||||
res = Project
|
||||
.search(@current_user, true, @query, 1, @current_organization)
|
||||
.search(@current_user, false, @query, 1, @current_organization)
|
||||
|
||||
projects_list = []
|
||||
res.each do |project_res|
|
||||
|
@ -61,7 +61,7 @@ class SmartAnnotation
|
|||
def experiments
|
||||
# Search experiments
|
||||
res = Experiment
|
||||
.search(@current_user, true, @query, 1, @current_organization)
|
||||
.search(@current_user, false, @query, 1, @current_organization)
|
||||
|
||||
experiments_list = []
|
||||
res.each do |experiment_res|
|
||||
|
@ -84,7 +84,7 @@ class SmartAnnotation
|
|||
def samples
|
||||
# Search samples
|
||||
res = Sample
|
||||
.search(@current_user, true, @query, 1, @current_organization)
|
||||
.search(@current_user, false, @query, 1, @current_organization)
|
||||
|
||||
samples_list = []
|
||||
res.each do |sample_res|
|
||||
|
|
Loading…
Reference in a new issue