Skip to content

Commit

Permalink
Merge pull request #4480 from sanger/develop
Browse files Browse the repository at this point in the history
[automated] Merge Develop into Master
  • Loading branch information
BenTopping authored Nov 5, 2024
2 parents f27116a + 1c3ceaf commit 6da9ec3
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 9 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/check_release_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@ on:
pull_request:
branches:
- master
types:
# defaults
- opened
- synchronize
- reopened
# custom
- ready_for_review # required for Github-created PRs

jobs:
check:
runs-on: ubuntu-latest
# only run when PR is not draft
if: ${{ !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Get specific changed files
id: changed-files-specific
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/create_release_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Create or update merge-to-master pull requests for production releases
# Note that by design, creating or editing a PR will not trigger a downstream `pull_request` event as this could lead to recursion
name: Release
on:
push:
branches:
- develop
jobs:
pull_request:
uses: sanger/.github/.github/workflows/create-release-pr.yml@master
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.47.0
14.48.0
2 changes: 1 addition & 1 deletion app/controllers/api/v2/bait_library_layouts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def preview
respond_with_errors('Validation failed', e.record.errors.full_messages, :unprocessable_entity) and return
end

json = { data: { type: 'bait_library_layouts', attributes: { layout: preview.layout } } }
json = { data: { type: 'bait_library_layouts', attributes: { well_layout: preview.well_layout } } }
render json: json, status: :ok
end

Expand Down
6 changes: 5 additions & 1 deletion app/models/delegate_validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ def valid?
return true if @validators.map(&:valid?).all?(true)

@validators.each do |validator|
validator.errors.each { |attrib, message| errors.add(attrib, message) unless errors.include?(attrib) }
validator.errors.each do |error|
attrib = error.attribute
message = error.message
errors.add(attrib, message) unless errors.include?(attrib)
end
end

false
Expand Down
16 changes: 15 additions & 1 deletion app/views/receptacles/new_request.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<% instance_variable_or_id_param(:request_type) do |field_name, value| %>
<div class="form-group col-xs-12">
<%= label_tag(field_name, 'Request type', class: 'col-md-4') %>
<%= select_field_sorted_by_name(field_name, @request_types, value, can_edit) %>
<%= select_field_sorted_by_name(field_name, @request_types, value, can_edit, prompt: 'Select a request type', required: true,
data: { novaseq_ids: RequestType.where(key: %w[illumina_htp_novaseq_6000_paired_end_sequencing illumina_htp_novaseqx_paired_end_sequencing]).pluck(:id).join(',') }
) %>
</div>
<% end %>
<% if @asset.studies.uniq.count > 1 -%>
Expand Down Expand Up @@ -104,13 +106,25 @@
var disable_inputs = function(context) { $('input,select,textarea', context).attr('disabled', true); }
var enable_inputs = function(context) { $('input,select,textarea', context).attr('disabled', false); }


<!-- Sets the 'required' attribute for the flowcell type input field based on the selected request type.-->
setFlowcellTypeRequiredForNovaseq = function() {
var selected_request_type_id = $('option:selected', request_type_element).attr('value');
var flowcell_type_element = $('[name="request[request_metadata_attributes][requested_flowcell_type]"]:not(:disabled)');
if(flowcell_type_element && flowcell_type_element.length > 0) {
var novaseq_ids = $(request_type_element).data('novaseq-ids').split(',');
flowcell_type_element.attr('required', novaseq_ids.includes(selected_request_type_id));
}
}

handler = function() {
var selected_request_type_id = $('option:selected', request_type_element).attr('value');

// Not only hide but disable inputs; not only show, but enable inputs. If this isn't done
// the parameters passed to the server are incorrect.
disable_inputs(request_options.hide());
enable_inputs($('#request_type_options_for_' + selected_request_type_id).show());
setFlowcellTypeRequiredForNovaseq()
}

request_type_element.change(handler);
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/metadata/edit/_request.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%- request.request_metadata.field_infos.each do |field_info| %>
<!-- todo unify with how submission use field info-->
<%- if field_info.selection %>
<%= metadata_fields.select(field_info.key, field_info.selection) %>
<%= metadata_fields.select(field_info.key, field_info.selection, { prompt: "Select a #{field_info.key.to_s.gsub( '_', ' ')}" }) %>
<%- elsif field_info.kind == FieldInfo::BOOLEAN %>
<%= metadata_fields.check_box(field_info.key) %>
<%- elsif field_info.kind == FieldInfo::NUMERIC %>
Expand Down
5 changes: 5 additions & 0 deletions config/default_records/plate_purposes/005_limber_purposes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ LTN AL Lib:
LTN Lib PCR XP:
type: PlatePurpose
stock_plate: false

# RVI BCL plate for reISC
RVI Lib PCR XP:
type: PlatePurpose
stock_plate: false
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ limber_reisc:
acceptable_purposes:
- LB Lib PCR-XP
- LTN Lib PCR XP # for Targeted NanoSeq ReISC
- RVI Lib PCR XP # for RVI Bait Capture Library
library_types:
- Agilent Pulldown
- Twist Pulldown
- Duplex-Seq
- Targeted NanoSeq Pulldown Twist
- Targeted NanoSeq Pulldown Agilent
- BGE
- RVI-BCL
limber_pcr_free:
<<: *limber_htp_library
name: Limber PCR Free
Expand Down
116 changes: 115 additions & 1 deletion spec/features/assets/asset_submission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,126 @@
let(:study) { create(:study) }
let(:request_factory) { :sequencing_request }
let(:asset) { create(:library_tube) }
let(:flowcell_types) { create_list(:flowcell_type, 2) }
let(:request_types) { create_list(:sequencing_request_type, 2) }
let(:original_request_type) { request_types.first }
let(:selected_request_type) { original_request_type }
let(:selected_read_length) { '76' }
let(:request_flowcell_type_validator) do
RequestType::Validator.create(
request_type: selected_request_type,
request_option: 'requested_flowcell_type',
valid_options: flowcell_types.map(&:name)
)
end
let!(:original_request) do
create(request_factory, study: study, project: project, asset: asset, request_type: original_request_type)
create(request_factory, study: study, project: project, asset: asset, request_type: selected_request_type)
end

describe 'The request form does not set default values' do
let(:user) { create(:admin) }

before do
login_user user
visit labware_path(asset)
click_link 'Request additional sequencing'
end

describe 'when the form is loaded' do
it 'does not set request type' do
expect(page).to have_select('Request type', selected: 'Select a request type')
end
end

describe 'when the user selects a request type' do
before { select 'Request Type 1', from: 'Request type' }

it 'does not set flowcell type to default value' do
expect(page).to have_select('Flowcell type', selected: 'Select a requested flowcell type')
end

it 'does not set read length to default value' do
expect(page).to have_select('Read length', selected: 'Select a read length')
end
end
end

describe 'Validation of Flowcell Type field for request types that require a Flowcell Type' do
let(:user) { create(:admin) }

# Mock the validator for the selected request type to return the predefined flowcell type validator
# the predefined flowcell type validator require a specific flowcell type to be selected
before do
allow(selected_request_type).to receive(:validator_for).with('requested_flowcell_type').and_return(
request_flowcell_type_validator
)
login_user user
visit labware_path(asset)
click_link 'Request additional sequencing'
end

it 'displays an error if Flowcell Type is not set' do
select(selected_request_type.name, from: 'Request type')
select(study.name, from: 'Study')
select(project.name, from: 'Project')
fill_in 'Fragment size required (from)', with: '100'
fill_in 'Fragment size required (to)', with: '200'
select(selected_read_length, from: 'Read length')
click_button 'Create'

# The JS native validation error 'Please select an item in the list' is being displayed but cannot be inspected.
expect(page).to have_no_text 'Created request'

redirect_path =
new_request_receptacle_path(
asset.receptacle,
study_id: study.id,
project_id: project.id,
request_type_id: selected_request_type.id
)
expect(page).to have_current_path(redirect_path)
end

it 'creates a new request successfully when Flowcell Type is correctly set' do
select(selected_request_type.name, from: 'Request type')
select(study.name, from: 'Study')
select(project.name, from: 'Project')
fill_in 'Fragment size required (from)', with: '100'
fill_in 'Fragment size required (to)', with: '200'
select(selected_read_length, from: 'Read length')
select('Flowcell 1', from: 'Flowcell type')
fill_in 'Fragment size required (from)', with: '100'
fill_in 'Fragment size required (to)', with: '200'
select(selected_read_length, from: 'Read length')
click_button 'Create'

expect(page).to have_text 'Created request'
end
end

describe 'Validation of Flowcell Type field for request types that do not require a Flowcell Type' do
let(:user) { create(:admin) }

before do
login_user user
visit labware_path(asset)
click_link 'Request additional sequencing'
end

it 'creates a new request successfully even when Flowcell Type is not specified' do
select(selected_request_type.name, from: 'Request type')
select(study.name, from: 'Study')
select(project.name, from: 'Project')
fill_in 'Fragment size required (from)', with: '100'
fill_in 'Fragment size required (to)', with: '200'
select(selected_read_length, from: 'Read length')
fill_in 'Fragment size required (from)', with: '100'
fill_in 'Fragment size required (to)', with: '200'
select(selected_read_length, from: 'Read length')
click_button 'Create'

expect(page).to have_text 'Created request'
end
end

shared_examples 'it allows additional sequencing' do
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/api/v2/bait_library_layouts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ def perform_post
expect(json.dig('data', 'type')).to eq(resource_type)
end

it 'returns a layout as an attribute' do
expect(json.dig('data', 'attributes', 'layout')).not_to be_nil
it 'returns a well_layout as an attribute' do
expect(json.dig('data', 'attributes', 'well_layout')).not_to be_nil
end
end

Expand Down

0 comments on commit 6da9ec3

Please sign in to comment.