Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Y24-051 - hide pooling tab if not relevant #4646

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions app/resources/api/v2/submission_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SubmissionResource < BaseResource
attribute :updated_at, readonly: true
attribute :used_tags, write_once: true
attribute :lanes_of_sequencing, write_once: true
attribute :multiplexed?, readonly: true

# Filters
filter :uuid, apply: ->(records, value, _options) { records.with_uuid(value) }
Expand All @@ -46,6 +47,9 @@ def lanes_of_sequencing
_model.sequencing_requests.size
end

# Added for use in Limber Presenters to decide whether to show the pooling tab
delegate :multiplexed?, to: :_model

# Class method overrides
end
end
Expand Down
19 changes: 19 additions & 0 deletions spec/resources/api/v2/submission_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
expect(resource).to have_attribute :created_at
expect(resource).to have_attribute :updated_at
expect(resource).to have_attribute :lanes_of_sequencing
expect(resource).to have_attribute :multiplexed?
expect(resource).not_to have_updatable_field(:id)
expect(resource).not_to have_updatable_field(:uuid)
expect(resource).not_to have_updatable_field(:state)
Expand All @@ -42,4 +43,22 @@
expect(resource.lanes_of_sequencing).to eq 3
end
end

describe '#multiplexed?' do
context 'when the submission is multiplexed' do
before { allow(resource_model).to receive(:multiplexed?).and_return(true) }

it 'returns whether the submission is multiplexed' do
expect(resource.multiplexed?).to be true
end
end

context 'when the submission is not multiplexed' do
before { allow(resource_model).to receive(:multiplexed?).and_return(false) }

it 'returns whether the submission is multiplexed' do
expect(resource.multiplexed?).to be false
end
end
end
end