mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-04 14:44:26 +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('experiments.project_id IN (?)', projects_ids)
|
||||||
.where_attributes_like([:name], a_query)
|
.where_attributes_like([:name], a_query)
|
||||||
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
||||||
return new_query
|
return include_archived ? new_query : new_query.is_archived(false)
|
||||||
elsif include_archived
|
elsif include_archived
|
||||||
new_query =
|
new_query =
|
||||||
Experiment
|
Experiment
|
||||||
|
|
|
@ -76,7 +76,11 @@ class MyModule < ActiveRecord::Base
|
||||||
.where('my_modules.experiment_id IN (?)', experiments_ids)
|
.where('my_modules.experiment_id IN (?)', experiments_ids)
|
||||||
.where_attributes_like([:name], a_query)
|
.where_attributes_like([:name], a_query)
|
||||||
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
||||||
|
if include_archived
|
||||||
return new_query
|
return new_query
|
||||||
|
else
|
||||||
|
return new_query.where('my_modules.archived = ?', false)
|
||||||
|
end
|
||||||
elsif include_archived
|
elsif include_archived
|
||||||
new_query = MyModule
|
new_query = MyModule
|
||||||
.distinct
|
.distinct
|
||||||
|
|
|
@ -54,7 +54,11 @@ class Project < ActiveRecord::Base
|
||||||
user.id)
|
user.id)
|
||||||
.where_attributes_like(:name, a_query)
|
.where_attributes_like(:name, a_query)
|
||||||
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
.limit(Constants::ATWHO_SEARCH_LIMIT)
|
||||||
|
if include_archived
|
||||||
return new_query
|
return new_query
|
||||||
|
else
|
||||||
|
return new_query.where('projects.archived = ?', false)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
org_ids =
|
org_ids =
|
||||||
Organization
|
Organization
|
||||||
|
|
|
@ -13,7 +13,7 @@ class SmartAnnotation
|
||||||
def my_modules
|
def my_modules
|
||||||
# Search tasks
|
# Search tasks
|
||||||
res = MyModule
|
res = MyModule
|
||||||
.search(@current_user, true, @query, 1, @current_organization)
|
.search(@current_user, false, @query, 1, @current_organization)
|
||||||
|
|
||||||
modules_list = []
|
modules_list = []
|
||||||
res.each do |my_module_res|
|
res.each do |my_module_res|
|
||||||
|
@ -42,7 +42,7 @@ class SmartAnnotation
|
||||||
def projects
|
def projects
|
||||||
# Search projects
|
# Search projects
|
||||||
res = Project
|
res = Project
|
||||||
.search(@current_user, true, @query, 1, @current_organization)
|
.search(@current_user, false, @query, 1, @current_organization)
|
||||||
|
|
||||||
projects_list = []
|
projects_list = []
|
||||||
res.each do |project_res|
|
res.each do |project_res|
|
||||||
|
@ -61,7 +61,7 @@ class SmartAnnotation
|
||||||
def experiments
|
def experiments
|
||||||
# Search experiments
|
# Search experiments
|
||||||
res = Experiment
|
res = Experiment
|
||||||
.search(@current_user, true, @query, 1, @current_organization)
|
.search(@current_user, false, @query, 1, @current_organization)
|
||||||
|
|
||||||
experiments_list = []
|
experiments_list = []
|
||||||
res.each do |experiment_res|
|
res.each do |experiment_res|
|
||||||
|
@ -84,7 +84,7 @@ class SmartAnnotation
|
||||||
def samples
|
def samples
|
||||||
# Search samples
|
# Search samples
|
||||||
res = Sample
|
res = Sample
|
||||||
.search(@current_user, true, @query, 1, @current_organization)
|
.search(@current_user, false, @query, 1, @current_organization)
|
||||||
|
|
||||||
samples_list = []
|
samples_list = []
|
||||||
res.each do |sample_res|
|
res.each do |sample_res|
|
||||||
|
|
Loading…
Reference in a new issue