Skip to content

Commit b183a9c

Browse files
committed
Clean public indexes
Only genomes that serve as nomenclatural type of public names can be seen here
1 parent 2ff0df3 commit b183a9c

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def main
4242
names: Name.all_public.order(created_at: :desc),
4343
publications: Publication.all.order(journal_date: :desc),
4444
register_lists: Register.where(validated: true).order(updated_at: :desc),
45-
genomes: Genome.all.order(created_at: :desc),
45+
genomes: Genome.all_public.order(created_at: :desc),
4646
strains: Strain.all.order(created_at: :desc)
4747
}
4848
@display = {

app/controllers/genomes_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GenomesController < ApplicationController
1616

1717
# GET /genomes or /genomes.json
1818
def index
19-
@genomes = Genome.all.order(created_at: :desc)
19+
@genomes = Genome.all_public.order(created_at: :desc)
2020
.paginate(page: params[:page], per_page: 30)
2121
@crumbs = ['Genomes']
2222
end

app/models/genome.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ def required
8080
]
8181
end
8282

83-
8483
def miga_project_path
8584
File.join(Rails.root, '..', 'miga_check')
8685
end
86+
87+
def all_public
88+
where(typified_names: Name.all_public)
89+
end
8790
end
8891

8992
@@FIELDS_WITH_AUTO = %i[

app/models/strain.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ class Strain < ApplicationRecord
1212
include HasExternalResources
1313
include Strain::ExternalResources
1414

15+
class << self
16+
def all_public
17+
where(typified_names: Name.all_public)
18+
end
19+
end
20+
1521
def numbers
1622
numbers_string.split(' = ')
1723
end

0 commit comments

Comments
 (0)