Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/controllers/concerns/name_filterable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def name_status_filters

# Maps status strings to their corresponding integer values.
# @param status [String] The status string (e.g., 'SeqCode', 'ICNP').
# @return [Integer, Array<Integer>] The status value(s).
# @return [Integer, Array<Integer>, nil] The status value(s), or nil (no
# status filter) for 'all' and other statuses, such as 'user' in lists
# that are already filtered (e.g., observed names)
def map_status_to_value(status)
status = status.to_s.downcase
return nil if status == 'all'

status = 'icnafp' if status == 'icn'
name_status_filters[status] || status
name_status_filters[status]
end
end

Expand Down
12 changes: 12 additions & 0 deletions test/controllers/names_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ class NamesControllerTest < ActionDispatch::IntegrationTest
assert_includes @response.body, names(:draft_by_contributor).name
end

test 'observing lists all observed names regardless of status' do
names(:escherichia).add_observer(@user)
names(:draft_by_contributor).add_observer(@user)

get observing_names_url

assert_response :success
assert_includes @response.body, names(:escherichia).name
assert_includes @response.body, names(:draft_by_contributor).name
assert_not_includes @response.body, names(:escherichia_coli).name
end

test 'type_genomes JSON reports the nomenclatural type class as Genome' do
get name_type_genomes_url(format: :json)

Expand Down
Loading