Skip to content

Commit

Permalink
Merge branch 'develop' into develop-Y24-190
Browse files Browse the repository at this point in the history
# Conflicts:
#	.rubocop_todo.yml
  • Loading branch information
sdjmchattie committed Oct 21, 2024
2 parents a2f2b33 + 3288801 commit ec83232
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 465 deletions.
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.44.0
14.45.0
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,9 @@ RSpec/ExpectInHook:
Enabled: false
# New in Ruby 3.2 upgrade
# Added to Rubocop Todo and handling from there

RSpec/MultipleMemoizedHelpers: # new in 1.43
Enabled: false # We don't see a benefit to limiting the number of memoized helpers.

RSpec/NestedGroups: # new in 1.7
Max: 6 # Set a more reasonable max. We've been happy with our existing nesting.
236 changes: 0 additions & 236 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1143,159 +1143,6 @@ RSpec/MultipleExpectations:
- 'spec/views/labware/show_chromium_chip_spec.rb'
- 'spec/views/samples/index_html_erb_spec.rb'

# Offense count: 1115
# Configuration parameters: AllowSubject, Max.
RSpec/MultipleMemoizedHelpers:
Exclude:
- 'spec/api/extraction_attributes_spec.rb'
- 'spec/api/labware_spec.rb'
- 'spec/api/multiplexed_library_tube_spec.rb'
- 'spec/api/plate_spec.rb'
- 'spec/api/qcable_creator_spec.rb'
- 'spec/api/receptacle_spec.rb'
- 'spec/api/specific_tube_creation_spec.rb'
- 'spec/api/state_change_spec.rb'
- 'spec/api/submission_pool_spec.rb'
- 'spec/api/tag_layout_template_spec.rb'
- 'spec/api/transfer_request_collection_spec.rb'
- 'spec/api/tube_creation_spec.rb'
- 'spec/api/well_spec.rb'
- 'spec/api/work_completion_spec.rb'
- 'spec/bulk_submission_excel/data_worksheet_spec.rb'
- 'spec/bulk_submission_excel/download_spec.rb'
- 'spec/controllers/api/v2/bioscan/export_pool_xp_to_traction_controller_spec.rb'
- 'spec/controllers/api/v2/heron/plates_controller_spec.rb'
- 'spec/controllers/api/v2/heron/tube_racks_controller_spec.rb'
- 'spec/controllers/driver_files_controller_spec.rb'
- 'spec/controllers/npg_actions/assets_controller_spec.rb'
- 'spec/controllers/receptacles_controller_spec.rb'
- 'spec/controllers/robot_verifications_controller_spec.rb'
- 'spec/controllers/searches_controller_spec.rb'
- 'spec/controllers/studies/information_controller_spec.rb'
- 'spec/controllers/studies_controller_spec.rb'
- 'spec/features/assets/asset_submission_spec.rb'
- 'spec/features/creating_a_quad_stamp_spec.rb'
- 'spec/features/generate_a_bulk_submission_template_spec.rb'
- 'spec/features/gpl207_bug_incorrect_submission_id_on_transfer_spec.rb'
- 'spec/features/location_reports/location_reports_spec.rb'
- 'spec/features/patient_consent_withdrawl_spec.rb'
- 'spec/features/perform_a_tag_substitution_spec.rb'
- 'spec/features/pipelines/cherrypick/cherrypick_for_fluidigm_pipeline_micro_litre_spec.rb'
- 'spec/features/pipelines/cherrypick/cherrypick_pipeline_spec.rb'
- 'spec/features/pipelines/creating_an_empty_batch_spec.rb'
- 'spec/features/pipelines/sequencing/following_a_sequencing_pipeline_spec.rb'
- 'spec/features/pipelines/sequencing/following_a_sequencing_pipeline_with_compound_sample_creation_spec.rb'
- 'spec/features/pipelines/viewing_request_comments_spec.rb'
- 'spec/features/pooling_spec.rb'
- 'spec/features/retrospective_failure_spec.rb'
- 'spec/features/sample_manifests/create_manifest_spec.rb'
- 'spec/features/starting_transfers_on_repools_starts_repools_spec.rb'
- 'spec/features/studies/view_study_request_links_spec.rb'
- 'spec/features/submissions/bulk_submissions_spec.rb'
- 'spec/helpers/batches_helper_spec.rb'
- 'spec/insdc/import_countries_spec.rb'
- 'spec/jobs/export_pool_xp_to_traction_job_spec.rb'
- 'spec/lib/label_printer/batch_plate_spec.rb'
- 'spec/lib/label_printer/swipecard_spec.rb'
- 'spec/lib/record_loader/submission_template_loader_spec.rb'
- 'spec/models/ability_spec.rb'
- 'spec/models/aliquot_spec.rb'
- 'spec/models/api/aliquot_io_spec.rb'
- 'spec/models/api/messages/flowcell_io_spec.rb'
- 'spec/models/api/messages/pac_bio_run_io_spec.rb'
- 'spec/models/api/messages/pac_bio_run_with_tag2_io_spec.rb'
- 'spec/models/api/messages/well_stock_resource_io_spec.rb'
- 'spec/models/barcode_spec.rb'
- 'spec/models/broadcast_event/broadcast_event_spec.rb'
- 'spec/models/broadcast_event/helpers/external_subjects_spec.rb'
- 'spec/models/broadcast_event/lab_event_spec.rb'
- 'spec/models/broadcast_event/plate_cherrypicked_spec.rb'
- 'spec/models/broadcast_event/pool_released_spec.rb'
- 'spec/models/broadcast_event/qc_assay_spec.rb'
- 'spec/models/broadcast_event/sequencing_complete_spec.rb'
- 'spec/models/bulk_submission_spec.rb'
- 'spec/models/comment_spec.rb'
- 'spec/models/external_release_event_spec.rb'
- 'spec/models/heron/factories/concerns/contents_spec.rb'
- 'spec/models/heron/factories/plate_spec.rb'
- 'spec/models/illumina_htp/initial_stock_tube_purpose_spec.rb'
- 'spec/models/labware_spec.rb'
- 'spec/models/linear_submission_spec.rb'
- 'spec/models/location_report_form_spec.rb'
- 'spec/models/orders/order_spec.rb'
- 'spec/models/plate/quad_creator_spec.rb'
- 'spec/models/plate_barcode_spec.rb'
- 'spec/models/pooling_spec.rb'
- 'spec/models/qc_result/qc_result_factory_spec.rb'
- 'spec/models/receptacle/downstream_aliquots_removal_spec.rb'
- 'spec/models/receptacle_spec.rb'
- 'spec/models/request/sample_compound_aliquot_transfer_spec.rb'
- 'spec/models/request/traction/grid_ion_spec.rb'
- 'spec/models/request_information_type_spec.rb'
- 'spec/models/request_spec.rb'
- 'spec/models/robot/pick_data_spec.rb'
- 'spec/models/robot/verification/source_dest_beds_spec.rb'
- 'spec/models/robot/verification/source_dest_control_beds_spec.rb'
- 'spec/models/sample_manifest/generator_spec.rb'
- 'spec/models/sample_manifest_spec.rb'
- 'spec/models/sequencing_request_spec.rb'
- 'spec/models/specific_tube_creations_spec.rb'
- 'spec/models/state_changer/initial_stock_tube_spec.rb'
- 'spec/models/state_changer/mx_tube_spec.rb'
- 'spec/models/state_changer/qcable_library_plate_spec.rb'
- 'spec/models/state_changer/standard_plate_spec.rb'
- 'spec/models/state_changer/stock_tube_spec.rb'
- 'spec/models/std_library_request_spec.rb'
- 'spec/models/study_spec.rb'
- 'spec/models/submission_spec.rb'
- 'spec/models/tag_layout_spec.rb'
- 'spec/models/tag_layout_template_spec.rb'
- 'spec/models/tag_set_spec.rb'
- 'spec/models/tag_substitutions_spec.rb'
- 'spec/models/tasks/cherrypick_task_spec.rb'
- 'spec/models/tasks/plate_template_task_spec.rb'
- 'spec/models/tasks/set_descriptors_handler/handler_spec.rb'
- 'spec/models/transfer_request_collection_spec.rb'
- 'spec/models/transfer_request_spec.rb'
- 'spec/models/tube_rack_spec.rb'
- 'spec/models/work_completion_spec.rb'
- 'spec/requests/api/v2/bait_library_layouts_spec.rb'
- 'spec/requests/api/v2/custom_metadatum_collections_spec.rb'
- 'spec/requests/api/v2/heron/plates_spec.rb'
- 'spec/requests/api/v2/heron/tube_racks_spec.rb'
- 'spec/requests/api/v2/plates_spec.rb'
- 'spec/requests/api/v2/pooled_plate_creations_spec.rb'
- 'spec/requests/api/v2/receptacles_spec.rb'
- 'spec/requests/api/v2/specific_tube_creations_spec.rb'
- 'spec/requests/api/v2/state_changes_spec.rb'
- 'spec/requests/api/v2/tag_layouts_spec.rb'
- 'spec/requests/api/v2/transfer_request_collections_spec.rb'
- 'spec/requests/api/v2/transfers_spec.rb'
- 'spec/requests/api/v2/tube_from_tube_creations_spec.rb'
- 'spec/requests/api/v2/wells_spec.rb'
- 'spec/requests/plate_picks_request_spec.rb'
- 'spec/resources/api/v2/plate_purpose_resource_spec.rb'
- 'spec/sample_manifest_excel/upload/processor_spec.rb'
- 'spec/sample_manifest_excel/upload/row_spec.rb'
- 'spec/sample_manifest_excel/upload/upload_spec.rb'
- 'spec/sample_manifest_excel/worksheet_spec.rb'
- 'spec/sequencescape_excel/column_spec.rb'
- 'spec/sequencescape_excel/specialised_field_spec.rb'
- 'spec/shared_contexts/limber_shared_context.rb'
- 'spec/tasks/support/add_stock_rna_plate_to_working_dilution_parents_spec.rb'
- 'spec/tasks/support/remove_duplicate_asset_links_spec.rb'
- 'spec/uat_actions/generate_plates_spec.rb'
- 'spec/uat_actions/generate_sample_manifest_spec.rb'
- 'spec/uat_actions/generate_tag_layout_template_spec.rb'
- 'spec/uat_actions/generate_tagged_plates_spec.rb'
- 'spec/uat_actions/plate_information_spec.rb'
- 'spec/uat_actions/test_submission_spec.rb'
- 'spec/uat_actions/tube_submission_spec.rb'
- 'spec/uat_actions/uat_actions_spec.rb'
- 'spec/views/labware/show_chromium_chip_spec.rb'
- 'spec/views/labware/show_html_erb_spec.rb'
- 'spec/views/tube_rack_summaries/show_html_erb_spec.rb'

# Offense count: 376
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
Expand Down Expand Up @@ -1363,89 +1210,6 @@ RSpec/NamedSubject:
- 'spec/resources/api/v2/tag_group_resource_spec.rb'
- 'spec/resources/api/v2/tube_resource_spec.rb'

# Offense count: 523
# Configuration parameters: Max, AllowedGroups.
RSpec/NestedGroups:
Exclude:
- 'spec/api/extraction_attributes_spec.rb'
- 'spec/api/specific_tube_creation_spec.rb'
- 'spec/api/tube_creation_spec.rb'
- 'spec/controllers/bulk_submission_excel/downloads_controller_spec.rb'
- 'spec/controllers/lab_searches_controller_spec.rb'
- 'spec/controllers/labwhere_receptions_controller_spec.rb'
- 'spec/controllers/report_fails_controller_spec.rb'
- 'spec/controllers/robot_verifications_controller_spec.rb'
- 'spec/controllers/samples_controller_spec.rb'
- 'spec/controllers/searches_controller_spec.rb'
- 'spec/controllers/studies_controller_spec.rb'
- 'spec/controllers/submissions_controller_spec.rb'
- 'spec/features/gpl207_bug_incorrect_submission_id_on_transfer_spec.rb'
- 'spec/features/sample_manifests/uploader_for_manifests_with_tag_sequences_spec.rb'
- 'spec/features/submissions/bulk_submissions_spec.rb'
- 'spec/helpers/assets_helper_spec.rb'
- 'spec/models/api/messages/flowcell_io_spec.rb'
- 'spec/models/broadcast_event/broadcast_event_spec.rb'
- 'spec/models/broadcast_event/plate_cherrypicked_spec.rb'
- 'spec/models/heron/factories/concerns/contents_spec.rb'
- 'spec/models/heron/factories/plate_spec.rb'
- 'spec/models/heron/factories/sample_spec.rb'
- 'spec/models/illumina_htp/initial_stock_tube_purpose_spec.rb'
- 'spec/models/labware_spec.rb'
- 'spec/models/linear_submission_spec.rb'
- 'spec/models/location_report_form_spec.rb'
- 'spec/models/location_report_spec.rb'
- 'spec/models/map_spec.rb'
- 'spec/models/orders/order_spec.rb'
- 'spec/models/phi_x/spiked_buffer_spec.rb'
- 'spec/models/phi_x/stock_spec.rb'
- 'spec/models/plate/quad_creator_spec.rb'
- 'spec/models/plate_purpose/additional_input_spec.rb'
- 'spec/models/plate_spec.rb'
- 'spec/models/qc_result/qc_result_factory_spec.rb'
- 'spec/models/receptacle_spec.rb'
- 'spec/models/request/sample_compound_aliquot_transfer_spec.rb'
- 'spec/models/request_spec.rb'
- 'spec/models/request_type_spec.rb'
- 'spec/models/robot/pick_data_spec.rb'
- 'spec/models/sample_manifest_spec.rb'
- 'spec/models/sequencing_request_spec.rb'
- 'spec/models/state_changer/mx_tube_spec.rb'
- 'spec/models/state_changer/standard_plate_spec.rb'
- 'spec/models/std_library_request_spec.rb'
- 'spec/models/study_spec.rb'
- 'spec/models/tag_group/adapter_type_spec.rb'
- 'spec/models/tag_layout_spec.rb'
- 'spec/models/tag_layout_template_spec.rb'
- 'spec/models/tag_set_spec.rb'
- 'spec/models/tag_substitutions_spec.rb'
- 'spec/models/tasks/cherrypick_task_spec.rb'
- 'spec/models/transfer_request_collection_spec.rb'
- 'spec/models/transfer_request_spec.rb'
- 'spec/models/tube_rack_spec.rb'
- 'spec/models/well_spec.rb'
- 'spec/requests/api/v2/bait_library_layouts_spec.rb'
- 'spec/requests/api/v2/custom_metadatum_collections_spec.rb'
- 'spec/requests/api/v2/heron/plates_spec.rb'
- 'spec/requests/api/v2/heron/tube_racks_spec.rb'
- 'spec/requests/api/v2/pooled_plate_creations_spec.rb'
- 'spec/requests/api/v2/sample_metadata_spec.rb'
- 'spec/requests/api/v2/specific_tube_creations_spec.rb'
- 'spec/requests/api/v2/state_changes_spec.rb'
- 'spec/requests/api/v2/tag_layouts_spec.rb'
- 'spec/requests/api/v2/transfer_request_collections_spec.rb'
- 'spec/requests/api/v2/transfers_spec.rb'
- 'spec/requests/api/v2/tube_from_tube_creations_spec.rb'
- 'spec/requests/api/v2/users_spec.rb'
- 'spec/sample_manifest_excel/upload/processor_spec.rb'
- 'spec/sample_manifest_excel/upload/upload_spec.rb'
- 'spec/sequencescape_excel/specialised_field_spec.rb'
- 'spec/tasks/create_mbrave_tags_spec.rb'
- 'spec/uat_actions/generate_plates_spec.rb'
- 'spec/uat_actions/generate_project_spec.rb'
- 'spec/uat_actions/generate_sample_manifest_spec.rb'
- 'spec/uat_actions/generate_study_spec.rb'
- 'spec/validators/novaseqx_pe_validator_spec.rb'

# Offense count: 6
RSpec/RepeatedDescription:
Exclude:
Expand Down
35 changes: 6 additions & 29 deletions app/models/cherrypick_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,8 @@ class CherrypickTask < Task # rubocop:todo Metrics/ClassLength
#
# @return [CherrypickTask::ControlLocator] A generator of control locations
#

def new_control_locator(params)
CherrypickTask::ControlLocator.new(
batch_id: params[:batch_id],
total_wells: params[:total_wells],
num_control_wells: params[:num_control_wells],
wells_to_leave_free: params[:wells_to_leave_free] || DEFAULT_WELLS_TO_LEAVE_FREE,
control_source_plate: params[:control_source_plate],
template: params[:template]
)
def new_control_locator(batch_id, total_wells, num_control_wells, wells_to_leave_free: DEFAULT_WELLS_TO_LEAVE_FREE)
CherrypickTask::ControlLocator.new(batch_id:, total_wells:, num_control_wells:, wells_to_leave_free:)
end

#
Expand All @@ -46,7 +38,7 @@ def can_link_directly?
# rubocop:todo Metrics/ParameterLists
def pick_new_plate(requests, template, robot, plate_purpose, control_source_plate = nil, workflow_controller = nil)
target_type = PickTarget.for(plate_purpose)
perform_pick(requests, robot, control_source_plate, workflow_controller, template) do
perform_pick(requests, robot, control_source_plate, workflow_controller) do
target_type.new(template, plate_purpose.try(:asset_shape))
end
end
Expand All @@ -62,7 +54,7 @@ def pick_onto_partial_plate(
purpose = partial_plate.plate_purpose
target_type = PickTarget.for(purpose)

perform_pick(requests, robot, control_source_plate, workflow_controller, template) do
perform_pick(requests, robot, control_source_plate, workflow_controller) do
target_type
.new(template, purpose.try(:asset_shape), partial_plate)
.tap do
Expand All @@ -74,7 +66,7 @@ def pick_onto_partial_plate(
# rubocop:enable Metrics/ParameterLists

# rubocop:todo Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
def perform_pick(requests, robot, control_source_plate, workflow_controller, template) # rubocop:todo Metrics/AbcSize
def perform_pick(requests, robot, control_source_plate, workflow_controller) # rubocop:todo Metrics/AbcSize
max_plates = robot.max_beds
raise StandardError, 'The chosen robot has no beds!' if max_plates.zero?

Expand All @@ -88,22 +80,7 @@ def perform_pick(requests, robot, control_source_plate, workflow_controller, tem
num_plate = 0
batch = requests.first.batch
control_assets = control_source_plate.wells.joins(:samples)
control_locator =
new_control_locator(
{
batch_id: batch.id,
total_wells: current_destination_plate.size,
num_control_wells: control_assets.count,
template: template,
control_source_plate: control_source_plate
}
)

if control_locator.handle_incompatible_plates
message = 'The control plate and plate template are incompatible'
workflow_controller.send(:flash)[:error] = message unless workflow_controller.nil?
workflow_controller.redirect_to action: 'stage', batch_id: batch.id, workflow_id: workflow.id
end
control_locator = new_control_locator(batch.id, current_destination_plate.size, control_assets.count)
control_posns = control_locator.control_positions(num_plate)

# If is an incomplete plate, or a plate with a template applied, copy all the controls missing into the
Expand Down
Loading

0 comments on commit ec83232

Please sign in to comment.