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:
okriuchykhin 2017-01-18 13:50:22 +01:00 committed by GitHub
commit 8a220c2351
4 changed files with 15 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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|