sequencescape icon indicating copy to clipboard operation
sequencescape copied to clipboard

DPL-1081 [BUG] Don't allow selection of inappropriate templates

Open KatyTaylor opened this issue 1 year ago • 0 comments

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:

  1. Go to page 'UAT Actions' - Generate Plate (defaults are fine) - copy resulting barcode
  2. Go to homepage - 'Create Submission'
  3. Template = "Cherrypick for Fluidigm", Fluidigm Chip = "Fluidigm 192-24"
  4. Add Order
  5. Fill out a study and project
  6. Add Samples - from Plate and Wells - paste barcode you copied earlier
  7. Click off box, click Save Order, then Build Submission, refresh page until submission built
  8. Go to Pipelines - Cherrypick for Fluidigm - select box associated with your submission, click Create Batch - Submit
  9. Click Select Plate Template
  10. 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)
  11. 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_wellwasnilon one of the iterations.current_wellis set bycurrent_well = plate[col*plate_rows + row]- this was trying to access an element that was not in the array. This happened becauseplatecontained 96 wells, whileplate_rowsandplate_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.

KatyTaylor avatar Feb 01 '24 14:02 KatyTaylor