sequencescape
sequencescape copied to clipboard
DPL-1081 [BUG] Don't allow selection of inappropriate templates
Describe the bug On the 'Select Plate Template' screen in the Cherrypicking pipelines, you are allowed to select templates that are not appropriate for the intended size of the destination plate. This can cause an unhandled exception to occur when the next screen is loaded.
RT Ticket Number Would prevent https://rt.sanger.ac.uk/Ticket/Display.html?id=796306 from happening again in future.
To Reproduce Steps to reproduce the behaviour:
- Go to page 'UAT Actions' - Generate Plate (defaults are fine) - copy resulting barcode
- Go to homepage - 'Create Submission'
- Template = "Cherrypick for Fluidigm", Fluidigm Chip = "Fluidigm 192-24"
- Add Order
- Fill out a study and project
- Add Samples - from Plate and Wells - paste barcode you copied earlier
- Click off box, click Save Order, then Build Submission, refresh page until submission built
- Go to Pipelines - Cherrypick for Fluidigm - select box associated with your submission, click Create Batch - Submit
- Click Select Plate Template
- Select Output plate purpose as "Fluidigm 192-24" (Problem - how to get to a screen where this is an option - still need to work out - think you might have to work through several cherrypicking steps to get there, because there are multiple request types in the submission)
- Notice Template list includes many templates whose size is not 192 (in the database, these are Labware where sti_type is "PlateTemplate")
Expected behaviour The template list should only contain templates whose size matches that of the output plate purpose.
Also, if they do somehow manage to select an inappropriate template, the exception should be handled gracefully. More is explained below.
Additional context
In the RT, the exception came from workflows > _plate.html.erb
line 20 - undefined method
[]' for nil:NilClass, meaning that
current_wellwas
nilon one of the iterations.
current_wellis set by
current_well = plate[col*plate_rows + row]- this was trying to access an element that was not in the array. This happened because
platecontained 96 wells, while
plate_rowsand
plate_cols` were 16 and 12 respectively - so the sizes were mismatching.
plate
, plate_rows
and plate_cols
are passed in by _cherrypick_batches.html.erb
and generated by _cherrypick_handler
, at the end of render_cherrypick_task
method.
@plate_rows
and @plate_cols
come from the destination plate, if it's a partial, or else the destination plate purpose.
@plates
is generated by pick_new_plate
in cherrypick_task
- initially a list of wells by build_plate_wells_from_requests
, then they get split into plates by the lambda push_completed_plate
, after the check current_destination_plate.full?
.
current_destination_plate.full?
comes from pick_target.rb
, which uses the size
passed in from the template
(selected in the UI.
So ultimately, the plate purpose size and the plate template size were mismatched and it should be enforced that they are the same.