From 3b505318fb6f2eab4e9dcc94e557611b031c787e Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 27 Jan 2025 12:12:10 +0000 Subject: [PATCH 01/15] test: add example test cases --- spec/models/well_spec.rb | 66 +++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index 893bd4ed1b..a39762877a 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -261,31 +261,46 @@ end end + # TODO: Y24-383 - add assertions for final source and destination volumes + + # rubocop:todo Layout/LineLength + + # stree-ignore [ - [1000, 10, 50, 50, 0, nil], - [1000, 10, 10, 10, 0, nil], - [1000, 10, 20, 10, 0, 10], - [100, 100, 50, 1, 9, nil], - [1000, 1000, 50, 1, 9, nil], - [5000, 1000, 50, 5, 5, nil], - [10, 100, 50, 1, 9, nil], - [1000, 250, 50, 4, 6, nil], - [10_000, 250, 50, 40, 0, nil], - [10_000, 250, 30, 30, 0, nil] - # rubocop:todo Metrics/ParameterLists - ].each do |target_ng, measured_concentration, measured_volume, stock_to_pick, buffer_added, current_volume| - # rubocop:enable Metrics/ParameterLists + { target_ng: 1000, measured_conc: 10, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 50, buffer_vol: 0, current_vol: nil }, + { target_ng: 1000, measured_conc: 10, measured_vol: 10, min_vol:10, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, current_vol: nil }, + { target_ng: 1000, measured_conc: 10, measured_vol: 20, min_vol:10, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, current_vol: 10 }, + { target_ng: 100, measured_conc: 100, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, + { target_ng: 1000, measured_conc: 1000, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, + { target_ng: 5000, measured_conc: 1000, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 5, buffer_vol: 5, current_vol: nil }, + { target_ng: 10, measured_conc: 100, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, + { target_ng: 1000, measured_conc: 250, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 4, buffer_vol: 6, current_vol: nil }, + { target_ng: 10_000, measured_conc: 250, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 40, buffer_vol: 0, current_vol: nil }, + { target_ng: 10_000, measured_conc: 250, measured_vol: 30, min_vol:10, min_pick_vol: 1, source_pick_vol: 30, buffer_vol: 0, current_vol: nil }, + { target_ng: 1000, measured_conc: 70, measured_vol: 50, min_vol:10, min_pick_vol: 5, source_pick_vol: 14.29, buffer_vol: 0, current_vol: nil },# Y24-382: SQPD-10861 v14.29, b0.00 + { target_ng: 200, measured_conc: 200, measured_vol: 1, min_vol:50, min_pick_vol: 5, source_pick_vol: 1, buffer_vol: 49, current_vol: nil }, # Y24-382: SQPD-10864 v1.00, b49.00 + { target_ng: 9800, measured_conc: 98, measured_vol: 100, min_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, current_vol: nil }, # Y24-382: SQPD-10866 v50.00, b0.00 + { target_ng: 9800, measured_conc: 100, measured_vol: 100, min_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, current_vol: nil } # Y24-382: SQPD-10868 v50.00, b0.00 + ].each do |cherrypick| + # rubocop:enable Layout/LineLength + target_ng = cherrypick[:target_ng] + concentration = cherrypick[:measured_conc] + measured_volume = cherrypick[:measured_vol] + stock_to_pick = cherrypick[:source_pick_vol] + buffer_added = cherrypick[:buffer_vol] + current_volume = cherrypick[:current_vol] + minimum_volume = cherrypick[:min_vol] + robot_minimum_picking_volume = cherrypick[:min_pick_vol] + context 'cherrypick by nano grams' do before do @source_well = create(:well) @target_well = create(:well) - minimum_volume = 10 maximum_volume = 50 - robot_minimum_picking_volume = 1.0 @source_well.well_attribute.update!( - concentration: measured_concentration, - measured_volume: measured_volume, - current_volume: current_volume + concentration:, + measured_volume:, + current_volume: ) @target_well.volume_to_cherrypick_by_nano_grams( minimum_volume, @@ -296,15 +311,14 @@ ) end - # rubocop:disable Layout/LineLength - it "output stock_to_pick #{stock_to_pick} for a target of #{target_ng} with vol #{measured_volume} and conc #{measured_concentration}" do - expect(@target_well.well_attribute.picked_volume).to eq(stock_to_pick) + # rubocop:todo Layout/LineLength + it "output stock_to_pick #{stock_to_pick} for a target of #{target_ng} with vol #{measured_volume} and conc #{concentration}" do + expect(@target_well.well_attribute.picked_volume.round(2)).to eq(stock_to_pick) end - # rubocop:enable Layout/LineLength - # rubocop:disable Layout/LineLength - it "output buffer #{buffer_added} for a target of #{target_ng} with vol #{measured_volume} and conc #{measured_concentration}" do + # rubocop:todo Layout/LineLength + it "output buffer #{buffer_added} for a target of #{target_ng} with vol #{measured_volume} and conc #{concentration}" do expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) end # rubocop:enable Layout/LineLength @@ -419,6 +433,7 @@ expect(well.get_buffer_volume + vol_to_pick).to eq(5.0) end + # TODO: Y24-383 - add assertions for final source and destination volumes [ [100.0, 50.0, 100.0, 200.0, nil, 50.0, 50.0, 'Standard scenario, sufficient material, buffer and dna both added'], [ @@ -437,7 +452,8 @@ [100.0, 5.0, 100.0, 2.0, 5.0, 5.0, 98.0, 'Less DNA than robot minimum pick'], [100.0, 50.0, 1.0, 200.0, 5.0, 100.0, 0.0, 'Low concentration, maximum DNA, no buffer'], [120.0, 50.0, 0, 60.0, 5.0, 60.0, 60.0, 'Zero concentration, with less volume than required'], - [120.0, 50.0, 0, 3.0, 5.0, 5.0, 117.0, 'Zero concentration, with less volume than even the minimum robot pick'] + [120.0, 50.0, 0, 3.0, 5.0, 5.0, 117.0, 'Zero concentration, with less volume than even the minimum robot pick'], + [15.0, 50.0, 70.0, 50, 5.0, 10.7, 5.0, 'Y24-382: SQPD-10859 v10.71 b5.00'] # rubocop:todo Metrics/ParameterLists,Layout/LineLength ].each do |final_volume_desired, final_conc_desired, source_concentration, source_volume, robot_minimum_pick_volume, source_volume_obtained, buffer_volume_obtained, scenario| # rubocop:enable Metrics/ParameterLists,Layout/LineLength From b18f7510da5f6e12bd566f928b968c75476571b5 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 4 Feb 2025 11:04:09 +0000 Subject: [PATCH 02/15] test: add maximum_volume as test parameter --- spec/models/well_spec.rb | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index a39762877a..977fc09356 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -267,20 +267,20 @@ # stree-ignore [ - { target_ng: 1000, measured_conc: 10, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 50, buffer_vol: 0, current_vol: nil }, - { target_ng: 1000, measured_conc: 10, measured_vol: 10, min_vol:10, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, current_vol: nil }, - { target_ng: 1000, measured_conc: 10, measured_vol: 20, min_vol:10, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, current_vol: 10 }, - { target_ng: 100, measured_conc: 100, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, - { target_ng: 1000, measured_conc: 1000, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, - { target_ng: 5000, measured_conc: 1000, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 5, buffer_vol: 5, current_vol: nil }, - { target_ng: 10, measured_conc: 100, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, - { target_ng: 1000, measured_conc: 250, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 4, buffer_vol: 6, current_vol: nil }, - { target_ng: 10_000, measured_conc: 250, measured_vol: 50, min_vol:10, min_pick_vol: 1, source_pick_vol: 40, buffer_vol: 0, current_vol: nil }, - { target_ng: 10_000, measured_conc: 250, measured_vol: 30, min_vol:10, min_pick_vol: 1, source_pick_vol: 30, buffer_vol: 0, current_vol: nil }, - { target_ng: 1000, measured_conc: 70, measured_vol: 50, min_vol:10, min_pick_vol: 5, source_pick_vol: 14.29, buffer_vol: 0, current_vol: nil },# Y24-382: SQPD-10861 v14.29, b0.00 - { target_ng: 200, measured_conc: 200, measured_vol: 1, min_vol:50, min_pick_vol: 5, source_pick_vol: 1, buffer_vol: 49, current_vol: nil }, # Y24-382: SQPD-10864 v1.00, b49.00 - { target_ng: 9800, measured_conc: 98, measured_vol: 100, min_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, current_vol: nil }, # Y24-382: SQPD-10866 v50.00, b0.00 - { target_ng: 9800, measured_conc: 100, measured_vol: 100, min_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, current_vol: nil } # Y24-382: SQPD-10868 v50.00, b0.00 + { target_ng: 1000, measured_conc: 10, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 50, buffer_vol: 0, current_vol: nil }, + { target_ng: 1000, measured_conc: 10, measured_vol: 10, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, current_vol: nil }, + { target_ng: 1000, measured_conc: 10, measured_vol: 20, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, current_vol: 10 }, + { target_ng: 100, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, + { target_ng: 1000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, + { target_ng: 5000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 5, buffer_vol: 5, current_vol: nil }, + { target_ng: 10, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, + { target_ng: 1000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 4, buffer_vol: 6, current_vol: nil }, + { target_ng: 10_000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 40, buffer_vol: 0, current_vol: nil }, + { target_ng: 10_000, measured_conc: 250, measured_vol: 30, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 30, buffer_vol: 0, current_vol: nil }, + { target_ng: 1000, measured_conc: 70, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 5, source_pick_vol: 14.29, buffer_vol: 0, current_vol: nil },# Y24-382: SQPD-10861 v14.29, b0.00 + { target_ng: 200, measured_conc: 200, measured_vol: 1, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 1, buffer_vol: 49, current_vol: nil }, # Y24-382: SQPD-10864 v1.00, b49.00 + { target_ng: 9800, measured_conc: 98, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, current_vol: nil }, # Y24-382: SQPD-10866 v50.00, b0.00 + { target_ng: 9800, measured_conc: 100, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, current_vol: nil } # Y24-382: SQPD-10868 v50.00, b0.00 ].each do |cherrypick| # rubocop:enable Layout/LineLength target_ng = cherrypick[:target_ng] @@ -290,13 +290,13 @@ buffer_added = cherrypick[:buffer_vol] current_volume = cherrypick[:current_vol] minimum_volume = cherrypick[:min_vol] + maximum_volume = cherrypick[:max_vol] robot_minimum_picking_volume = cherrypick[:min_pick_vol] context 'cherrypick by nano grams' do before do @source_well = create(:well) @target_well = create(:well) - maximum_volume = 50 @source_well.well_attribute.update!( concentration:, measured_volume:, From 2aa1b7a6cd708e308302e474a35c66543bbcfb52 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 4 Feb 2025 12:22:02 +0000 Subject: [PATCH 03/15] test: move estimated_volume to a separate check --- spec/models/well_attribute_spec.rb | 18 ++++++++++++++++++ spec/models/well_spec.rb | 29 +++++++++++++---------------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/spec/models/well_attribute_spec.rb b/spec/models/well_attribute_spec.rb index d4ba87ac3f..b990f55dd6 100644 --- a/spec/models/well_attribute_spec.rb +++ b/spec/models/well_attribute_spec.rb @@ -24,4 +24,22 @@ ) expect(Warren.handler.messages_matching("queue_broadcast.messenger.#{warehouse_message.id}")).to be 2 end + + describe '#estimated_volume' do + it 'returns the estimated volume as a float' do + well_attribute.current_volume = 10 + expect(well_attribute.estimated_volume).to eq 10.0 + end + + it 'returns the current volume if it is set' do + well_attribute.current_volume = 10 + well_attribute.measured_volume = 20 + expect(well_attribute.estimated_volume).to eq 10.0 + end + + it 'returns the measured volume if the current volume is not set' do + well_attribute.measured_volume = 20 + expect(well_attribute.estimated_volume).to eq 20.0 + end + end end diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index 977fc09356..e1565d79d2 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -267,20 +267,19 @@ # stree-ignore [ - { target_ng: 1000, measured_conc: 10, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 50, buffer_vol: 0, current_vol: nil }, - { target_ng: 1000, measured_conc: 10, measured_vol: 10, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, current_vol: nil }, - { target_ng: 1000, measured_conc: 10, measured_vol: 20, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, current_vol: 10 }, - { target_ng: 100, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, - { target_ng: 1000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, - { target_ng: 5000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 5, buffer_vol: 5, current_vol: nil }, - { target_ng: 10, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, current_vol: nil }, - { target_ng: 1000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 4, buffer_vol: 6, current_vol: nil }, - { target_ng: 10_000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 40, buffer_vol: 0, current_vol: nil }, - { target_ng: 10_000, measured_conc: 250, measured_vol: 30, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 30, buffer_vol: 0, current_vol: nil }, - { target_ng: 1000, measured_conc: 70, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 5, source_pick_vol: 14.29, buffer_vol: 0, current_vol: nil },# Y24-382: SQPD-10861 v14.29, b0.00 - { target_ng: 200, measured_conc: 200, measured_vol: 1, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 1, buffer_vol: 49, current_vol: nil }, # Y24-382: SQPD-10864 v1.00, b49.00 - { target_ng: 9800, measured_conc: 98, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, current_vol: nil }, # Y24-382: SQPD-10866 v50.00, b0.00 - { target_ng: 9800, measured_conc: 100, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, current_vol: nil } # Y24-382: SQPD-10868 v50.00, b0.00 + { target_ng: 1000, measured_conc: 10, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 50, buffer_vol: 0 }, + { target_ng: 1000, measured_conc: 10, measured_vol: 10, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0 }, + { target_ng: 100, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9 }, + { target_ng: 1000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9 }, + { target_ng: 5000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 5, buffer_vol: 5 }, + { target_ng: 10, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9 }, + { target_ng: 1000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 4, buffer_vol: 6 }, + { target_ng: 10_000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 40, buffer_vol: 0 }, + { target_ng: 10_000, measured_conc: 250, measured_vol: 30, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 30, buffer_vol: 0 }, + { target_ng: 1000, measured_conc: 70, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 5, source_pick_vol: 14.29, buffer_vol: 0 },# Y24-382: SQPD-10861 v14.29, b0.00 + { target_ng: 200, measured_conc: 200, measured_vol: 1, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 1, buffer_vol: 49 }, # Y24-382: SQPD-10864 v1.00, b49.00 + { target_ng: 9800, measured_conc: 98, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0 }, # Y24-382: SQPD-10866 v50.00, b0.00 + { target_ng: 9800, measured_conc: 100, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0 } # Y24-382: SQPD-10868 v50.00, b0.00 ].each do |cherrypick| # rubocop:enable Layout/LineLength target_ng = cherrypick[:target_ng] @@ -288,7 +287,6 @@ measured_volume = cherrypick[:measured_vol] stock_to_pick = cherrypick[:source_pick_vol] buffer_added = cherrypick[:buffer_vol] - current_volume = cherrypick[:current_vol] minimum_volume = cherrypick[:min_vol] maximum_volume = cherrypick[:max_vol] robot_minimum_picking_volume = cherrypick[:min_pick_vol] @@ -300,7 +298,6 @@ @source_well.well_attribute.update!( concentration:, measured_volume:, - current_volume: ) @target_well.volume_to_cherrypick_by_nano_grams( minimum_volume, From 292a30be0611e855eef66b4aca6ac6f90d771873 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 5 Feb 2025 09:02:42 +0000 Subject: [PATCH 04/15] test: add assertions for amount final source and destination volumes --- spec/models/well_spec.rb | 64 ++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index e1565d79d2..81ea6d5529 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -261,25 +261,23 @@ end end - # TODO: Y24-383 - add assertions for final source and destination volumes - # rubocop:todo Layout/LineLength # stree-ignore [ - { target_ng: 1000, measured_conc: 10, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 50, buffer_vol: 0 }, - { target_ng: 1000, measured_conc: 10, measured_vol: 10, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0 }, - { target_ng: 100, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9 }, - { target_ng: 1000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9 }, - { target_ng: 5000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 5, buffer_vol: 5 }, - { target_ng: 10, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9 }, - { target_ng: 1000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 4, buffer_vol: 6 }, - { target_ng: 10_000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 40, buffer_vol: 0 }, - { target_ng: 10_000, measured_conc: 250, measured_vol: 30, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 30, buffer_vol: 0 }, - { target_ng: 1000, measured_conc: 70, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 5, source_pick_vol: 14.29, buffer_vol: 0 },# Y24-382: SQPD-10861 v14.29, b0.00 - { target_ng: 200, measured_conc: 200, measured_vol: 1, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 1, buffer_vol: 49 }, # Y24-382: SQPD-10864 v1.00, b49.00 - { target_ng: 9800, measured_conc: 98, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0 }, # Y24-382: SQPD-10866 v50.00, b0.00 - { target_ng: 9800, measured_conc: 100, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0 } # Y24-382: SQPD-10868 v50.00, b0.00 + { target_ng: 1000, measured_conc: 10, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 50, buffer_vol: 0, final_src_vol: 0, final_dest_vol: 10 }, + { target_ng: 1000, measured_conc: 10, measured_vol: 10, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, final_src_vol: 0, final_dest_vol: 10 }, + { target_ng: 100, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, final_src_vol: 49, final_dest_vol: 10 }, + { target_ng: 1000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, final_src_vol: 49, final_dest_vol: 10 }, + { target_ng: 5000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 5, buffer_vol: 5, final_src_vol: 45, final_dest_vol: 10 }, + { target_ng: 10, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, final_src_vol: 49, final_dest_vol: 10 }, + { target_ng: 1000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 4, buffer_vol: 6, final_src_vol: 46, final_dest_vol: 10 }, + { target_ng: 10_000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 40, buffer_vol: 0, final_src_vol: 10, final_dest_vol: 10 }, + { target_ng: 10_000, measured_conc: 250, measured_vol: 30, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 30, buffer_vol: 0, final_src_vol: 0, final_dest_vol: 10 }, + { target_ng: 1000, measured_conc: 70, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 5, source_pick_vol: 14.29, buffer_vol: 0, final_src_vol: 35.7143, final_dest_vol: 10 }, # Y24-382: SQPD-10861 v14.29, b0.00 + { target_ng: 200, measured_conc: 200, measured_vol: 1, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 1, buffer_vol: 49, final_src_vol: 0, final_dest_vol: 50 }, # Y24-382: SQPD-10864 v1.00, b49.00 + { target_ng: 9800, measured_conc: 98, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, final_src_vol: 50, final_dest_vol: 50 }, # Y24-382: SQPD-10866 v50.00, b0.00 + { target_ng: 9800, measured_conc: 100, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, final_src_vol: 50, final_dest_vol: 50 }, # Y24-382: SQPD-10868 v50.00, b0.00 ].each do |cherrypick| # rubocop:enable Layout/LineLength target_ng = cherrypick[:target_ng] @@ -290,15 +288,14 @@ minimum_volume = cherrypick[:min_vol] maximum_volume = cherrypick[:max_vol] robot_minimum_picking_volume = cherrypick[:min_pick_vol] + final_source_volume = cherrypick[:final_src_vol] + final_destination_volume = cherrypick[:final_dest_vol] context 'cherrypick by nano grams' do before do @source_well = create(:well) @target_well = create(:well) - @source_well.well_attribute.update!( - concentration:, - measured_volume:, - ) + @source_well.well_attribute.update!(concentration:, measured_volume:) @target_well.volume_to_cherrypick_by_nano_grams( minimum_volume, maximum_volume, @@ -308,17 +305,28 @@ ) end - # rubocop:todo Layout/LineLength - it "output stock_to_pick #{stock_to_pick} for a target of #{target_ng} with vol #{measured_volume} and conc #{concentration}" do - expect(@target_well.well_attribute.picked_volume.round(2)).to eq(stock_to_pick) - end - # rubocop:enable Layout/LineLength + context "for a target of #{target_ng} with conc #{concentration} and vol #{measured_volume}" do + it "output stock_to_pick #{stock_to_pick}" do + expect(@target_well.well_attribute.picked_volume.round(2)).to eq(stock_to_pick) + end - # rubocop:todo Layout/LineLength - it "output buffer #{buffer_added} for a target of #{target_ng} with vol #{measured_volume} and conc #{concentration}" do - expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) + it "output buffer #{buffer_added}" do + expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) + end + + it "leaves a final source volume of #{final_source_volume}" do + # mirrored from CherrypickRequest.reduce_source_volume + # asset.get_current_volume - target_asset.get_picked_volume + current_volume = @source_well.get_current_volume + picked_volume = @target_well.get_picked_volume + calculated_volume = current_volume - picked_volume + expect(calculated_volume.round(2)).to eq(final_source_volume.round(2)) + end + + it "provides a final destination volume of #{final_destination_volume}" do + expect(@target_well.well_attribute.current_volume).to eq(final_destination_volume) + end end - # rubocop:enable Layout/LineLength end end From 708a6e46a01cc5a779e8f238056f3e5bf44b993e Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 5 Feb 2025 14:12:21 +0000 Subject: [PATCH 05/15] test: refactor value assignment --- spec/models/well_spec.rb | 46 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index 81ea6d5529..911b84357b 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -439,29 +439,31 @@ end # TODO: Y24-383 - add assertions for final source and destination volumes + # rubocop:todo Layout/LineLength + + # stree-ignore [ - [100.0, 50.0, 100.0, 200.0, nil, 50.0, 50.0, 'Standard scenario, sufficient material, buffer and dna both added'], - [ - 100.0, - 50.0, - 100.0, - 20.0, - nil, - 20.0, - 80.0, - 'Insufficient source material for concentration or volume. Make up with buffer' - ], - [100.0, 5.0, 100.0, 2.0, nil, 2.0, 98.0, 'As above, just more extreme'], - [100.0, 5.0, 100.0, 5.0, 5.0, 5.0, 95.0, 'High concentration, minimum robot volume increases source pick'], - [100.0, 50.0, 52.0, 200.0, 5.0, 96.2, 5.0, 'Lowish concentration, non zero, but less than robot buffer required'], - [100.0, 5.0, 100.0, 2.0, 5.0, 5.0, 98.0, 'Less DNA than robot minimum pick'], - [100.0, 50.0, 1.0, 200.0, 5.0, 100.0, 0.0, 'Low concentration, maximum DNA, no buffer'], - [120.0, 50.0, 0, 60.0, 5.0, 60.0, 60.0, 'Zero concentration, with less volume than required'], - [120.0, 50.0, 0, 3.0, 5.0, 5.0, 117.0, 'Zero concentration, with less volume than even the minimum robot pick'], - [15.0, 50.0, 70.0, 50, 5.0, 10.7, 5.0, 'Y24-382: SQPD-10859 v10.71 b5.00'] - # rubocop:todo Metrics/ParameterLists,Layout/LineLength - ].each do |final_volume_desired, final_conc_desired, source_concentration, source_volume, robot_minimum_pick_volume, source_volume_obtained, buffer_volume_obtained, scenario| - # rubocop:enable Metrics/ParameterLists,Layout/LineLength + { final_volume_desired: 100.0, final_conc_desired: 50.0, source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, scenario: 'Standard scenario, sufficient material, buffer and dna both added' }, + { final_volume_desired: 100.0, final_conc_desired: 50.0, source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume:nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, scenario: 'Insufficient source material for concentration or volume. Make up with buffer' }, + { final_volume_desired: 100.0, final_conc_desired: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, scenario: 'As above, just more extreme' }, + { final_volume_desired: 100.0, final_conc_desired: 5.0, source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, scenario: 'High concentration, minimum robot volume increases source pick' }, + { final_volume_desired: 100.0, final_conc_desired: 50.0, source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, scenario: 'Lowish concentration, non zero, but less than robot buffer required' }, + { final_volume_desired: 100.0, final_conc_desired: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, scenario: 'Less DNA than robot minimum pick' }, + { final_volume_desired: 100.0, final_conc_desired: 50.0, source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, scenario: 'Low concentration, maximum DNA, no buffer' }, + { final_volume_desired: 120.0, final_conc_desired: 50.0, source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, scenario: 'Zero concentration, with less volume than required' }, + { final_volume_desired: 120.0, final_conc_desired: 50.0, source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, scenario: 'Zero concentration, with less volume than even the minimum robot pick' }, + { final_volume_desired: 15.0, final_conc_desired: 50.0, source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume:5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, scenario: 'Y24-382: SQPD-10859 v10.71 b5.00' }, + ].each do |cherrypick| + # rubocop:enable Layout/LineLength + final_volume_desired = cherrypick[:final_volume_desired] + final_conc_desired = cherrypick[:final_conc_desired] + source_concentration = cherrypick[:source_concentration] + source_volume = cherrypick[:source_volume] + robot_minimum_pick_volume = cherrypick[:robot_minimum_pick_volume] + source_volume_obtained = cherrypick[:source_volume_obtained] + buffer_volume_obtained = cherrypick[:buffer_volume_obtained] + scenario = cherrypick[:scenario] + context "when testing #{scenario}" do before do @result_volume = From 090f7f525bbdbeb97f044cca3dba3b2aeb2f05cf Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 5 Feb 2025 14:13:53 +0000 Subject: [PATCH 06/15] test: rename desired to target --- spec/models/well_spec.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index 911b84357b..94aa3fea3b 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -443,20 +443,20 @@ # stree-ignore [ - { final_volume_desired: 100.0, final_conc_desired: 50.0, source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, scenario: 'Standard scenario, sufficient material, buffer and dna both added' }, - { final_volume_desired: 100.0, final_conc_desired: 50.0, source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume:nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, scenario: 'Insufficient source material for concentration or volume. Make up with buffer' }, - { final_volume_desired: 100.0, final_conc_desired: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, scenario: 'As above, just more extreme' }, - { final_volume_desired: 100.0, final_conc_desired: 5.0, source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, scenario: 'High concentration, minimum robot volume increases source pick' }, - { final_volume_desired: 100.0, final_conc_desired: 50.0, source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, scenario: 'Lowish concentration, non zero, but less than robot buffer required' }, - { final_volume_desired: 100.0, final_conc_desired: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, scenario: 'Less DNA than robot minimum pick' }, - { final_volume_desired: 100.0, final_conc_desired: 50.0, source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, scenario: 'Low concentration, maximum DNA, no buffer' }, - { final_volume_desired: 120.0, final_conc_desired: 50.0, source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, scenario: 'Zero concentration, with less volume than required' }, - { final_volume_desired: 120.0, final_conc_desired: 50.0, source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, scenario: 'Zero concentration, with less volume than even the minimum robot pick' }, - { final_volume_desired: 15.0, final_conc_desired: 50.0, source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume:5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, scenario: 'Y24-382: SQPD-10859 v10.71 b5.00' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, scenario: 'Standard scenario, sufficient material, buffer and dna both added' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume:nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, scenario: 'Insufficient source material for concentration or volume. Make up with buffer' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, scenario: 'As above, just more extreme' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, scenario: 'High concentration, minimum robot volume increases source pick' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, scenario: 'Lowish concentration, non zero, but less than robot buffer required' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, scenario: 'Less DNA than robot minimum pick' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, scenario: 'Low concentration, maximum DNA, no buffer' }, + { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, scenario: 'Zero concentration, with less volume than required' }, + { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, scenario: 'Zero concentration, with less volume than even the minimum robot pick' }, + { target_volume: 15.0, target_concentration: 50.0, source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume:5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, scenario: 'Y24-382: SQPD-10859 v10.71 b5.00' }, ].each do |cherrypick| # rubocop:enable Layout/LineLength - final_volume_desired = cherrypick[:final_volume_desired] - final_conc_desired = cherrypick[:final_conc_desired] + target_volume = cherrypick[:target_volume] + target_concentration = cherrypick[:target_concentration] source_concentration = cherrypick[:source_concentration] source_volume = cherrypick[:source_volume] robot_minimum_pick_volume = cherrypick[:robot_minimum_pick_volume] @@ -470,8 +470,8 @@ format( '%.1f', well.volume_to_cherrypick_by_nano_grams_per_micro_litre( - final_volume_desired, - final_conc_desired, + target_volume, + target_concentration, source_concentration, source_volume, robot_minimum_pick_volume From a124453401e9eb183c433c9a3abc41634c40f367 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 6 Feb 2025 10:50:58 +0000 Subject: [PATCH 07/15] test: add final source volumes --- spec/models/well_spec.rb | 44 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index 94aa3fea3b..18f0098ca1 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -438,21 +438,20 @@ expect(well.get_buffer_volume + vol_to_pick).to eq(5.0) end - # TODO: Y24-383 - add assertions for final source and destination volumes # rubocop:todo Layout/LineLength # stree-ignore [ - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, scenario: 'Standard scenario, sufficient material, buffer and dna both added' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume:nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, scenario: 'Insufficient source material for concentration or volume. Make up with buffer' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, scenario: 'As above, just more extreme' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, scenario: 'High concentration, minimum robot volume increases source pick' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, scenario: 'Lowish concentration, non zero, but less than robot buffer required' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, scenario: 'Less DNA than robot minimum pick' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, scenario: 'Low concentration, maximum DNA, no buffer' }, - { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, scenario: 'Zero concentration, with less volume than required' }, - { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, scenario: 'Zero concentration, with less volume than even the minimum robot pick' }, - { target_volume: 15.0, target_concentration: 50.0, source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume:5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, scenario: 'Y24-382: SQPD-10859 v10.71 b5.00' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Standard scenario, sufficient material, buffer and dna both added' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume:nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Insufficient source material for concentration or volume. Make up with buffer' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'As above, just more extreme' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'High concentration, minimum robot volume increases source pick' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Lowish concentration, non zero, but less than robot buffer required' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Less DNA than robot minimum pick' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Low concentration, maximum DNA, no buffer' }, + { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, source_volume_remaining: 120.0, destination_volume: 50.0, scenario: 'Zero concentration, with less volume than required' }, + { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, source_volume_remaining: 120.0, destination_volume: 50.0, scenario: 'Zero concentration, with less volume than even the minimum robot pick' }, + { target_volume: 15.0, target_concentration: 50.0, source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume:5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, source_volume_remaining: 15.0, destination_volume: 50.0, scenario: 'Y24-382: SQPD-10859 v10.71 b5.00' }, ].each do |cherrypick| # rubocop:enable Layout/LineLength target_volume = cherrypick[:target_volume] @@ -462,22 +461,22 @@ robot_minimum_pick_volume = cherrypick[:robot_minimum_pick_volume] source_volume_obtained = cherrypick[:source_volume_obtained] buffer_volume_obtained = cherrypick[:buffer_volume_obtained] + source_volume_remaining = cherrypick[:source_volume_remaining] + destination_volume = cherrypick[:destination_volume] scenario = cherrypick[:scenario] context "when testing #{scenario}" do before do - @result_volume = - format( - '%.1f', - well.volume_to_cherrypick_by_nano_grams_per_micro_litre( + @result_volume = well.volume_to_cherrypick_by_nano_grams_per_micro_litre( target_volume, target_concentration, source_concentration, source_volume, robot_minimum_pick_volume - ) - ).to_f - @result_buffer_volume = format('%.1f', well.get_buffer_volume).to_f + ).round(1) + @result_buffer_volume = well.get_buffer_volume.round(1) + @source_volume_remaining = well.get_current_volume.round(1) + @destination_volume = @target_well.well_attribute.current_volume.round(1) end it 'gets correct volume quantity' do @@ -487,6 +486,15 @@ it 'gets correct buffer volume measures' do expect(@result_buffer_volume).to eq(buffer_volume_obtained) end + + it 'gets correct source volume remaining' do + expect(@source_volume_remaining).to eq(source_volume_remaining) + end + + it 'gets correct destination volume' do + expect(@target_well.well_attribute.current_volume.round(2)).to eq(destination_volume.round(2)) + end + end end end From 32c80c3a03f40fbedd75ae0ffb658530bc4dd2a7 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 6 Feb 2025 16:00:27 +0000 Subject: [PATCH 08/15] test: add final destination volumes --- spec/models/well_spec.rb | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index 18f0098ca1..df87d04cf5 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -442,16 +442,16 @@ # stree-ignore [ - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Standard scenario, sufficient material, buffer and dna both added' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume:nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Insufficient source material for concentration or volume. Make up with buffer' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'As above, just more extreme' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'High concentration, minimum robot volume increases source pick' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Lowish concentration, non zero, but less than robot buffer required' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Less DNA than robot minimum pick' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, source_volume_remaining: 100.0, destination_volume: 50.0, scenario: 'Low concentration, maximum DNA, no buffer' }, - { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, source_volume_remaining: 120.0, destination_volume: 50.0, scenario: 'Zero concentration, with less volume than required' }, - { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, source_volume_remaining: 120.0, destination_volume: 50.0, scenario: 'Zero concentration, with less volume than even the minimum robot pick' }, - { target_volume: 15.0, target_concentration: 50.0, source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume:5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, source_volume_remaining: 15.0, destination_volume: 50.0, scenario: 'Y24-382: SQPD-10859 v10.71 b5.00' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Standard scenario, sufficient material, buffer and dna both added' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume:nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Insufficient source material for concentration or volume. Make up with buffer' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'As above, just more extreme' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'High concentration, minimum robot volume increases source pick' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Lowish concentration, non zero, but less than robot buffer required' }, + { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Less DNA than robot minimum pick' }, + { target_volume: 100.0, target_concentration: 50.0, source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Low concentration, maximum DNA, no buffer' }, + { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, source_volume_remaining: 120.0, destination_volume: 15.0, scenario: 'Zero concentration, with less volume than required' }, + { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, source_volume_remaining: 120.0, destination_volume: 15.0, scenario: 'Zero concentration, with less volume than even the minimum robot pick' }, + { target_volume: 15.0, target_concentration: 50.0, source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume:5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, source_volume_remaining: 15.0, destination_volume: 15.0, scenario: 'Y24-382: SQPD-10859 v10.71 b5.00' }, ].each do |cherrypick| # rubocop:enable Layout/LineLength target_volume = cherrypick[:target_volume] @@ -467,15 +467,18 @@ context "when testing #{scenario}" do before do - @result_volume = well.volume_to_cherrypick_by_nano_grams_per_micro_litre( + @source_well = create(:well) + @target_well = create(:well) + @source_well.well_attribute.update!(concentration:source_concentration, measured_volume:source_volume) + @result_volume = @source_well.volume_to_cherrypick_by_nano_grams_per_micro_litre( target_volume, target_concentration, source_concentration, source_volume, robot_minimum_pick_volume ).round(1) - @result_buffer_volume = well.get_buffer_volume.round(1) - @source_volume_remaining = well.get_current_volume.round(1) + @result_buffer_volume = @source_well.get_buffer_volume.round(1) + @source_volume_remaining = @source_well.get_current_volume.round(1) @destination_volume = @target_well.well_attribute.current_volume.round(1) end @@ -492,7 +495,7 @@ end it 'gets correct destination volume' do - expect(@target_well.well_attribute.current_volume.round(2)).to eq(destination_volume.round(2)) + expect(@destination_volume).to eq(destination_volume) end end From 15c3b317506534881fc0c709c14bea12908dc6d1 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 6 Feb 2025 16:04:10 +0000 Subject: [PATCH 09/15] style: reformat test to improve readbility --- spec/models/well_spec.rb | 178 +++++++++++++++++++++++++++++++-------- 1 file changed, 142 insertions(+), 36 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index df87d04cf5..1a2a6f6a16 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -438,48 +438,155 @@ expect(well.get_buffer_volume + vol_to_pick).to eq(5.0) end - # rubocop:todo Layout/LineLength - - # stree-ignore [ - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Standard scenario, sufficient material, buffer and dna both added' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume:nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Insufficient source material for concentration or volume. Make up with buffer' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'As above, just more extreme' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'High concentration, minimum robot volume increases source pick' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Lowish concentration, non zero, but less than robot buffer required' }, - { target_volume: 100.0, target_concentration: 5.0, source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Less DNA than robot minimum pick' }, - { target_volume: 100.0, target_concentration: 50.0, source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, source_volume_remaining: 100.0, destination_volume: 15.0, scenario: 'Low concentration, maximum DNA, no buffer' }, - { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, source_volume_remaining: 120.0, destination_volume: 15.0, scenario: 'Zero concentration, with less volume than required' }, - { target_volume: 120.0, target_concentration: 50.0, source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume:5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, source_volume_remaining: 120.0, destination_volume: 15.0, scenario: 'Zero concentration, with less volume than even the minimum robot pick' }, - { target_volume: 15.0, target_concentration: 50.0, source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume:5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, source_volume_remaining: 15.0, destination_volume: 15.0, scenario: 'Y24-382: SQPD-10859 v10.71 b5.00' }, + { + scenario: 'Standard scenario, sufficient material, buffer and dna both added', + target_volume: 100.0, + target_concentration: 50.0, + source_concentration: 100.0, + source_volume: 200.0, + robot_minimum_pick_volume: nil, + source_volume_obtained: 50.0, + buffer_volume_obtained: 50.0, + source_volume_remaining: 100.0, + destination_volume: 15.0 + }, + { + scenario: 'Insufficient source material for concentration or volume. Make up with buffer', + target_volume: 100.0, + target_concentration: 50.0, + source_concentration: 100.0, + source_volume: 20.0, + robot_minimum_pick_volume: nil, + source_volume_obtained: 20.0, + buffer_volume_obtained: 80.0, + source_volume_remaining: 100.0, + destination_volume: 15.0 + }, + { + scenario: 'As above, just more extreme', + target_volume: 100.0, + target_concentration: 5.0, + source_concentration: 100.0, + source_volume: 2.0, + robot_minimum_pick_volume: nil, + source_volume_obtained: 2.0, + buffer_volume_obtained: 98.0, + source_volume_remaining: 100.0, + destination_volume: 15.0 + }, + { + scenario: 'High concentration, minimum robot volume increases source pick', + target_volume: 100.0, + target_concentration: 5.0, + source_concentration: 100.0, + source_volume: 5.0, + robot_minimum_pick_volume: 5.0, + source_volume_obtained: 5.0, + buffer_volume_obtained: 95.0, + source_volume_remaining: 100.0, + destination_volume: 15.0 + }, + { + scenario: 'Lowish concentration, non zero, but less than robot buffer required', + target_volume: 100.0, + target_concentration: 50.0, + source_concentration: 52.0, + source_volume: 200.0, + robot_minimum_pick_volume: 5.0, + source_volume_obtained: 96.2, + buffer_volume_obtained: 5.0, + source_volume_remaining: 100.0, + destination_volume: 15.0 + }, + { + scenario: 'Less DNA than robot minimum pick', + target_volume: 100.0, + target_concentration: 5.0, + source_concentration: 100.0, + source_volume: 2.0, + robot_minimum_pick_volume: 5.0, + source_volume_obtained: 5.0, + buffer_volume_obtained: 98.0, + source_volume_remaining: 100.0, + destination_volume: 15.0 + }, + { + scenario: 'Low concentration, maximum DNA, no buffer', + target_volume: 100.0, + target_concentration: 50.0, + source_concentration: 1.0, + source_volume: 200.0, + robot_minimum_pick_volume: 5.0, + source_volume_obtained: 100.0, + buffer_volume_obtained: 0.0, + source_volume_remaining: 100.0, + destination_volume: 15.0 + }, + { + scenario: 'Zero concentration, with less volume than required', + target_volume: 120.0, + target_concentration: 50.0, + source_concentration: 0, + source_volume: 60.0, + robot_minimum_pick_volume: 5.0, + source_volume_obtained: 60.0, + buffer_volume_obtained: 60.0, + source_volume_remaining: 120.0, + destination_volume: 15.0 + }, + { + scenario: 'Zero concentration, with less volume than even the minimum robot pick', + target_volume: 120.0, + target_concentration: 50.0, + source_concentration: 0, + source_volume: 3.0, + robot_minimum_pick_volume: 5.0, + source_volume_obtained: 5.0, + buffer_volume_obtained: 117.0, + source_volume_remaining: 120.0, + destination_volume: 15.0 + }, + { + scenario: 'Y24-382: SQPD-10859 v10.71 b5.00', + target_volume: 15.0, + target_concentration: 50.0, + source_concentration: 70.0, + source_volume: 50, + robot_minimum_pick_volume: 5.0, + source_volume_obtained: 10.7, + buffer_volume_obtained: 5.0, + source_volume_remaining: 15.0, + destination_volume: 15.0 + } ].each do |cherrypick| - # rubocop:enable Layout/LineLength - target_volume = cherrypick[:target_volume] - target_concentration = cherrypick[:target_concentration] - source_concentration = cherrypick[:source_concentration] - source_volume = cherrypick[:source_volume] - robot_minimum_pick_volume = cherrypick[:robot_minimum_pick_volume] - source_volume_obtained = cherrypick[:source_volume_obtained] - buffer_volume_obtained = cherrypick[:buffer_volume_obtained] - source_volume_remaining = cherrypick[:source_volume_remaining] - destination_volume = cherrypick[:destination_volume] - scenario = cherrypick[:scenario] + scenario = cherrypick[:scenario] + target_volume = cherrypick[:target_volume] + target_concentration = cherrypick[:target_concentration] + source_concentration = cherrypick[:source_concentration] + source_volume = cherrypick[:source_volume] + robot_minimum_pick_volume = cherrypick[:robot_minimum_pick_volume] + source_volume_obtained = cherrypick[:source_volume_obtained] + buffer_volume_obtained = cherrypick[:buffer_volume_obtained] + source_volume_remaining = cherrypick[:source_volume_remaining] + destination_volume = cherrypick[:destination_volume] context "when testing #{scenario}" do before do @source_well = create(:well) @target_well = create(:well) - @source_well.well_attribute.update!(concentration:source_concentration, measured_volume:source_volume) - @result_volume = @source_well.volume_to_cherrypick_by_nano_grams_per_micro_litre( - target_volume, - target_concentration, - source_concentration, - source_volume, - robot_minimum_pick_volume - ).round(1) - @result_buffer_volume = @source_well.get_buffer_volume.round(1) - @source_volume_remaining = @source_well.get_current_volume.round(1) - @destination_volume = @target_well.well_attribute.current_volume.round(1) + @source_well.well_attribute.update!(concentration: source_concentration, measured_volume: source_volume) + @result_volume = + @source_well.volume_to_cherrypick_by_nano_grams_per_micro_litre( + target_volume, + target_concentration, + source_concentration, + source_volume, + robot_minimum_pick_volume + ).round(1) + @result_buffer_volume = @source_well.get_buffer_volume.round(1) + @source_volume_remaining = @source_well.get_current_volume.round(1) + @destination_volume = @target_well.well_attribute.current_volume.round(1) end it 'gets correct volume quantity' do @@ -497,7 +604,6 @@ it 'gets correct destination volume' do expect(@destination_volume).to eq(destination_volume) end - end end end From b1395442a47fa2cbdcc1be25740f834751f16c28 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 6 Feb 2025 16:55:00 +0000 Subject: [PATCH 10/15] test: update final volumes --- spec/models/well_spec.rb | 71 +++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index 1a2a6f6a16..a34f802678 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -448,8 +448,8 @@ robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, - source_volume_remaining: 100.0, - destination_volume: 15.0 + source_volume_remaining: 150.0, + destination_volume: 100.0 }, { scenario: 'Insufficient source material for concentration or volume. Make up with buffer', @@ -460,8 +460,8 @@ robot_minimum_pick_volume: nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, - source_volume_remaining: 100.0, - destination_volume: 15.0 + source_volume_remaining: 0.0, + destination_volume: 100.0 }, { scenario: 'As above, just more extreme', @@ -472,8 +472,8 @@ robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, - source_volume_remaining: 100.0, - destination_volume: 15.0 + source_volume_remaining: 0.0, + destination_volume: 100.0 }, { scenario: 'High concentration, minimum robot volume increases source pick', @@ -484,8 +484,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, - source_volume_remaining: 100.0, - destination_volume: 15.0 + source_volume_remaining: 0.0, + destination_volume: 100.0 }, { scenario: 'Lowish concentration, non zero, but less than robot buffer required', @@ -496,8 +496,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, - source_volume_remaining: 100.0, - destination_volume: 15.0 + source_volume_remaining: 103.8, + destination_volume: 100.0 }, { scenario: 'Less DNA than robot minimum pick', @@ -508,8 +508,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, - source_volume_remaining: 100.0, - destination_volume: 15.0 + source_volume_remaining: 0.0, + destination_volume: 100.0 }, { scenario: 'Low concentration, maximum DNA, no buffer', @@ -521,7 +521,7 @@ source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, source_volume_remaining: 100.0, - destination_volume: 15.0 + destination_volume: 100.0 }, { scenario: 'Zero concentration, with less volume than required', @@ -532,8 +532,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, - source_volume_remaining: 120.0, - destination_volume: 15.0 + source_volume_remaining: 0.0, + destination_volume: 120.0 }, { scenario: 'Zero concentration, with less volume than even the minimum robot pick', @@ -544,8 +544,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, - source_volume_remaining: 120.0, - destination_volume: 15.0 + source_volume_remaining: 0.0, + destination_volume: 120.0 }, { scenario: 'Y24-382: SQPD-10859 v10.71 b5.00', @@ -556,7 +556,7 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, - source_volume_remaining: 15.0, + source_volume_remaining: 39.3, destination_volume: 15.0 } ].each do |cherrypick| @@ -573,36 +573,41 @@ context "when testing #{scenario}" do before do + # Create source and target wells @source_well = create(:well) @target_well = create(:well) @source_well.well_attribute.update!(concentration: source_concentration, measured_volume: source_volume) - @result_volume = - @source_well.volume_to_cherrypick_by_nano_grams_per_micro_litre( - target_volume, - target_concentration, - source_concentration, - source_volume, - robot_minimum_pick_volume - ).round(1) - @result_buffer_volume = @source_well.get_buffer_volume.round(1) - @source_volume_remaining = @source_well.get_current_volume.round(1) - @destination_volume = @target_well.well_attribute.current_volume.round(1) + + # Perform cherrypick + @target_well.volume_to_cherrypick_by_nano_grams_per_micro_litre( + target_volume, + target_concentration, + source_concentration, + source_volume, + robot_minimum_pick_volume + ) + + # Perform bed verification + # mirrored from CherrypickRequest.reduce_source_volume + subtracted_volume = @target_well.get_picked_volume + new_volume = @source_well.get_current_volume - subtracted_volume + @source_well.set_current_volume(new_volume) end it 'gets correct volume quantity' do - expect(@result_volume).to eq(source_volume_obtained) + expect(@target_well.get_picked_volume.round(1)).to eq(source_volume_obtained) end it 'gets correct buffer volume measures' do - expect(@result_buffer_volume).to eq(buffer_volume_obtained) + expect(@target_well.get_buffer_volume.round(1)).to eq(buffer_volume_obtained) end it 'gets correct source volume remaining' do - expect(@source_volume_remaining).to eq(source_volume_remaining) + expect(@source_well.get_current_volume.round(1)).to eq(source_volume_remaining) end it 'gets correct destination volume' do - expect(@destination_volume).to eq(destination_volume) + expect(@target_well.get_current_volume.round(1)).to eq(destination_volume) end end end From df4afddd63602e00b96618fc21611c400913a488 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 6 Feb 2025 16:59:13 +0000 Subject: [PATCH 11/15] style: change test parameter order for reability --- spec/models/well_spec.rb | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index a34f802678..afa725ac74 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -448,8 +448,8 @@ robot_minimum_pick_volume: nil, source_volume_obtained: 50.0, buffer_volume_obtained: 50.0, - source_volume_remaining: 150.0, - destination_volume: 100.0 + destination_volume: 100.0, + source_volume_remaining: 150.0 }, { scenario: 'Insufficient source material for concentration or volume. Make up with buffer', @@ -460,8 +460,8 @@ robot_minimum_pick_volume: nil, source_volume_obtained: 20.0, buffer_volume_obtained: 80.0, - source_volume_remaining: 0.0, - destination_volume: 100.0 + destination_volume: 100.0, + source_volume_remaining: 0.0 }, { scenario: 'As above, just more extreme', @@ -472,8 +472,8 @@ robot_minimum_pick_volume: nil, source_volume_obtained: 2.0, buffer_volume_obtained: 98.0, - source_volume_remaining: 0.0, - destination_volume: 100.0 + destination_volume: 100.0, + source_volume_remaining: 0.0 }, { scenario: 'High concentration, minimum robot volume increases source pick', @@ -484,8 +484,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 95.0, - source_volume_remaining: 0.0, - destination_volume: 100.0 + destination_volume: 100.0, + source_volume_remaining: 0.0 }, { scenario: 'Lowish concentration, non zero, but less than robot buffer required', @@ -496,8 +496,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 96.2, buffer_volume_obtained: 5.0, - source_volume_remaining: 103.8, - destination_volume: 100.0 + destination_volume: 100.0, + source_volume_remaining: 103.8 }, { scenario: 'Less DNA than robot minimum pick', @@ -508,8 +508,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 98.0, - source_volume_remaining: 0.0, - destination_volume: 100.0 + destination_volume: 100.0, + source_volume_remaining: 0.0 }, { scenario: 'Low concentration, maximum DNA, no buffer', @@ -520,8 +520,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 100.0, buffer_volume_obtained: 0.0, - source_volume_remaining: 100.0, - destination_volume: 100.0 + destination_volume: 100.0, + source_volume_remaining: 100.0 }, { scenario: 'Zero concentration, with less volume than required', @@ -532,8 +532,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 60.0, buffer_volume_obtained: 60.0, - source_volume_remaining: 0.0, - destination_volume: 120.0 + destination_volume: 120.0, + source_volume_remaining: 0.0 }, { scenario: 'Zero concentration, with less volume than even the minimum robot pick', @@ -544,8 +544,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 5.0, buffer_volume_obtained: 117.0, - source_volume_remaining: 0.0, - destination_volume: 120.0 + destination_volume: 120.0, + source_volume_remaining: 0.0 }, { scenario: 'Y24-382: SQPD-10859 v10.71 b5.00', @@ -556,8 +556,8 @@ robot_minimum_pick_volume: 5.0, source_volume_obtained: 10.7, buffer_volume_obtained: 5.0, - source_volume_remaining: 39.3, - destination_volume: 15.0 + destination_volume: 15.0, + source_volume_remaining: 39.3 } ].each do |cherrypick| scenario = cherrypick[:scenario] @@ -568,8 +568,8 @@ robot_minimum_pick_volume = cherrypick[:robot_minimum_pick_volume] source_volume_obtained = cherrypick[:source_volume_obtained] buffer_volume_obtained = cherrypick[:buffer_volume_obtained] - source_volume_remaining = cherrypick[:source_volume_remaining] destination_volume = cherrypick[:destination_volume] + source_volume_remaining = cherrypick[:source_volume_remaining] context "when testing #{scenario}" do before do From dbaabb442382801036886fb4f652dc2c47b8b131 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 6 Feb 2025 17:00:08 +0000 Subject: [PATCH 12/15] refactor: rename _obtained -> _picked --- spec/models/well_spec.rb | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index afa725ac74..b37602d513 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -446,8 +446,8 @@ source_concentration: 100.0, source_volume: 200.0, robot_minimum_pick_volume: nil, - source_volume_obtained: 50.0, - buffer_volume_obtained: 50.0, + source_volume_picked: 50.0, + buffer_volume_picked: 50.0, destination_volume: 100.0, source_volume_remaining: 150.0 }, @@ -458,8 +458,8 @@ source_concentration: 100.0, source_volume: 20.0, robot_minimum_pick_volume: nil, - source_volume_obtained: 20.0, - buffer_volume_obtained: 80.0, + source_volume_picked: 20.0, + buffer_volume_picked: 80.0, destination_volume: 100.0, source_volume_remaining: 0.0 }, @@ -470,8 +470,8 @@ source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: nil, - source_volume_obtained: 2.0, - buffer_volume_obtained: 98.0, + source_volume_picked: 2.0, + buffer_volume_picked: 98.0, destination_volume: 100.0, source_volume_remaining: 0.0 }, @@ -482,8 +482,8 @@ source_concentration: 100.0, source_volume: 5.0, robot_minimum_pick_volume: 5.0, - source_volume_obtained: 5.0, - buffer_volume_obtained: 95.0, + source_volume_picked: 5.0, + buffer_volume_picked: 95.0, destination_volume: 100.0, source_volume_remaining: 0.0 }, @@ -494,8 +494,8 @@ source_concentration: 52.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, - source_volume_obtained: 96.2, - buffer_volume_obtained: 5.0, + source_volume_picked: 96.2, + buffer_volume_picked: 5.0, destination_volume: 100.0, source_volume_remaining: 103.8 }, @@ -506,8 +506,8 @@ source_concentration: 100.0, source_volume: 2.0, robot_minimum_pick_volume: 5.0, - source_volume_obtained: 5.0, - buffer_volume_obtained: 98.0, + source_volume_picked: 5.0, + buffer_volume_picked: 98.0, destination_volume: 100.0, source_volume_remaining: 0.0 }, @@ -518,8 +518,8 @@ source_concentration: 1.0, source_volume: 200.0, robot_minimum_pick_volume: 5.0, - source_volume_obtained: 100.0, - buffer_volume_obtained: 0.0, + source_volume_picked: 100.0, + buffer_volume_picked: 0.0, destination_volume: 100.0, source_volume_remaining: 100.0 }, @@ -530,8 +530,8 @@ source_concentration: 0, source_volume: 60.0, robot_minimum_pick_volume: 5.0, - source_volume_obtained: 60.0, - buffer_volume_obtained: 60.0, + source_volume_picked: 60.0, + buffer_volume_picked: 60.0, destination_volume: 120.0, source_volume_remaining: 0.0 }, @@ -542,8 +542,8 @@ source_concentration: 0, source_volume: 3.0, robot_minimum_pick_volume: 5.0, - source_volume_obtained: 5.0, - buffer_volume_obtained: 117.0, + source_volume_picked: 5.0, + buffer_volume_picked: 117.0, destination_volume: 120.0, source_volume_remaining: 0.0 }, @@ -554,8 +554,8 @@ source_concentration: 70.0, source_volume: 50, robot_minimum_pick_volume: 5.0, - source_volume_obtained: 10.7, - buffer_volume_obtained: 5.0, + source_volume_picked: 10.7, + buffer_volume_picked: 5.0, destination_volume: 15.0, source_volume_remaining: 39.3 } @@ -566,8 +566,8 @@ source_concentration = cherrypick[:source_concentration] source_volume = cherrypick[:source_volume] robot_minimum_pick_volume = cherrypick[:robot_minimum_pick_volume] - source_volume_obtained = cherrypick[:source_volume_obtained] - buffer_volume_obtained = cherrypick[:buffer_volume_obtained] + source_volume_picked = cherrypick[:source_volume_picked] + buffer_volume_picked = cherrypick[:buffer_volume_picked] destination_volume = cherrypick[:destination_volume] source_volume_remaining = cherrypick[:source_volume_remaining] @@ -595,11 +595,11 @@ end it 'gets correct volume quantity' do - expect(@target_well.get_picked_volume.round(1)).to eq(source_volume_obtained) + expect(@target_well.get_picked_volume.round(1)).to eq(source_volume_picked) end it 'gets correct buffer volume measures' do - expect(@target_well.get_buffer_volume.round(1)).to eq(buffer_volume_obtained) + expect(@target_well.get_buffer_volume.round(1)).to eq(buffer_volume_picked) end it 'gets correct source volume remaining' do From f40b62b8dde02664bf519ec6a8934a07bbc8d012 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 6 Feb 2025 17:21:16 +0000 Subject: [PATCH 13/15] test: fix broken expectation --- spec/models/well_attribute_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/models/well_attribute_spec.rb b/spec/models/well_attribute_spec.rb index b990f55dd6..906f47ce4e 100644 --- a/spec/models/well_attribute_spec.rb +++ b/spec/models/well_attribute_spec.rb @@ -28,12 +28,17 @@ describe '#estimated_volume' do it 'returns the estimated volume as a float' do well_attribute.current_volume = 10 - expect(well_attribute.estimated_volume).to eq 10.0 + expect(well_attribute.estimated_volume).to be_a(Float) end - it 'returns the current volume if it is set' do + it 'returns the estimated volume as the measured volume if both are set' do well_attribute.current_volume = 10 well_attribute.measured_volume = 20 + expect(well_attribute.estimated_volume).to eq 20.0 + end + + it 'returns the current volume if the measured volume is not set' do + well_attribute.current_volume = 10 expect(well_attribute.estimated_volume).to eq 10.0 end From 9f37b19509bc1831bd8fd7f388979e752e6161a9 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 6 Feb 2025 17:29:31 +0000 Subject: [PATCH 14/15] style: improve readbility of individual examples --- spec/models/well_spec.rb | 183 +++++++++++++++++++++++++++++++++++---- 1 file changed, 165 insertions(+), 18 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index b37602d513..cfdae3d136 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -261,25 +261,169 @@ end end - # rubocop:todo Layout/LineLength - - # stree-ignore [ - { target_ng: 1000, measured_conc: 10, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 50, buffer_vol: 0, final_src_vol: 0, final_dest_vol: 10 }, - { target_ng: 1000, measured_conc: 10, measured_vol: 10, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 10, buffer_vol: 0, final_src_vol: 0, final_dest_vol: 10 }, - { target_ng: 100, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, final_src_vol: 49, final_dest_vol: 10 }, - { target_ng: 1000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, final_src_vol: 49, final_dest_vol: 10 }, - { target_ng: 5000, measured_conc: 1000, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 5, buffer_vol: 5, final_src_vol: 45, final_dest_vol: 10 }, - { target_ng: 10, measured_conc: 100, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 1, buffer_vol: 9, final_src_vol: 49, final_dest_vol: 10 }, - { target_ng: 1000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 4, buffer_vol: 6, final_src_vol: 46, final_dest_vol: 10 }, - { target_ng: 10_000, measured_conc: 250, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 40, buffer_vol: 0, final_src_vol: 10, final_dest_vol: 10 }, - { target_ng: 10_000, measured_conc: 250, measured_vol: 30, min_vol:10, max_vol:50, min_pick_vol: 1, source_pick_vol: 30, buffer_vol: 0, final_src_vol: 0, final_dest_vol: 10 }, - { target_ng: 1000, measured_conc: 70, measured_vol: 50, min_vol:10, max_vol:50, min_pick_vol: 5, source_pick_vol: 14.29, buffer_vol: 0, final_src_vol: 35.7143, final_dest_vol: 10 }, # Y24-382: SQPD-10861 v14.29, b0.00 - { target_ng: 200, measured_conc: 200, measured_vol: 1, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 1, buffer_vol: 49, final_src_vol: 0, final_dest_vol: 50 }, # Y24-382: SQPD-10864 v1.00, b49.00 - { target_ng: 9800, measured_conc: 98, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, final_src_vol: 50, final_dest_vol: 50 }, # Y24-382: SQPD-10866 v50.00, b0.00 - { target_ng: 9800, measured_conc: 100, measured_vol: 100, min_vol:50, max_vol:50, min_pick_vol: 5, source_pick_vol: 50, buffer_vol: 0, final_src_vol: 50, final_dest_vol: 50 }, # Y24-382: SQPD-10868 v50.00, b0.00 + { + target_ng: 1000, + measured_conc: 10, + measured_vol: 50, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 50, + buffer_vol: 0, + final_src_vol: 0, + final_dest_vol: 10 + }, + { + target_ng: 1000, + measured_conc: 10, + measured_vol: 10, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 10, + buffer_vol: 0, + final_src_vol: 0, + final_dest_vol: 10 + }, + { + target_ng: 100, + measured_conc: 100, + measured_vol: 50, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 1, + buffer_vol: 9, + final_src_vol: 49, + final_dest_vol: 10 + }, + { + target_ng: 1000, + measured_conc: 1000, + measured_vol: 50, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 1, + buffer_vol: 9, + final_src_vol: 49, + final_dest_vol: 10 + }, + { + target_ng: 5000, + measured_conc: 1000, + measured_vol: 50, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 5, + buffer_vol: 5, + final_src_vol: 45, + final_dest_vol: 10 + }, + { + target_ng: 10, + measured_conc: 100, + measured_vol: 50, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 1, + buffer_vol: 9, + final_src_vol: 49, + final_dest_vol: 10 + }, + { + target_ng: 1000, + measured_conc: 250, + measured_vol: 50, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 4, + buffer_vol: 6, + final_src_vol: 46, + final_dest_vol: 10 + }, + { + target_ng: 10_000, + measured_conc: 250, + measured_vol: 50, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 40, + buffer_vol: 0, + final_src_vol: 10, + final_dest_vol: 10 + }, + { + target_ng: 10_000, + measured_conc: 250, + measured_vol: 30, + min_vol: 10, + max_vol: 50, + min_pick_vol: 1, + source_pick_vol: 30, + buffer_vol: 0, + final_src_vol: 0, + final_dest_vol: 10 + }, + { + scenario: 'Y24-382: SQPD-10861 v14.29, b0.00', + target_ng: 1000, + measured_conc: 70, + measured_vol: 50, + min_vol: 10, + max_vol: 50, + min_pick_vol: 5, + source_pick_vol: 14.29, + buffer_vol: 0, + final_src_vol: 35.7143, + final_dest_vol: 10 + }, + { + scenario: 'Y24-382: SQPD-10864 v1.00, b49.00', + target_ng: 200, + measured_conc: 200, + measured_vol: 1, + min_vol: 50, + max_vol: 50, + min_pick_vol: 5, + source_pick_vol: 1, + buffer_vol: 49, + final_src_vol: 0, + final_dest_vol: 50 + }, + { + scenario: 'Y24-382: SQPD-10866 v50.00, b0.00', + target_ng: 9800, + measured_conc: 98, + measured_vol: 100, + min_vol: 50, + max_vol: 50, + min_pick_vol: 5, + source_pick_vol: 50, + buffer_vol: 0, + final_src_vol: 50, + final_dest_vol: 50 + }, + { + scenario: 'Y24-382: SQPD-10868 v50.00, b0.00', + target_ng: 9800, + measured_conc: 100, + measured_vol: 100, + min_vol: 50, + max_vol: 50, + min_pick_vol: 5, + source_pick_vol: 50, + buffer_vol: 0, + final_src_vol: 50, + final_dest_vol: 50 + } ].each do |cherrypick| - # rubocop:enable Layout/LineLength + scenario = cherrypick.fetch(:scenario, nil) target_ng = cherrypick[:target_ng] concentration = cherrypick[:measured_conc] measured_volume = cherrypick[:measured_vol] @@ -305,7 +449,10 @@ ) end - context "for a target of #{target_ng} with conc #{concentration} and vol #{measured_volume}" do + context( + "when testing #{scenario}" \ + " for a target of #{target_ng} with conc #{concentration} and vol #{measured_volume}" + ) do it "output stock_to_pick #{stock_to_pick}" do expect(@target_well.well_attribute.picked_volume.round(2)).to eq(stock_to_pick) end From d1f1c5babf47c51fdaf9a852eafba9804227e7a2 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 10 Feb 2025 11:55:42 +0000 Subject: [PATCH 15/15] test: refactor stock_to_pick and wording --- spec/models/well_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index cfdae3d136..90beb49cc1 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -427,7 +427,7 @@ target_ng = cherrypick[:target_ng] concentration = cherrypick[:measured_conc] measured_volume = cherrypick[:measured_vol] - stock_to_pick = cherrypick[:source_pick_vol] + source_pick_vol = cherrypick[:source_pick_vol] buffer_added = cherrypick[:buffer_vol] minimum_volume = cherrypick[:min_vol] maximum_volume = cherrypick[:max_vol] @@ -451,13 +451,13 @@ context( "when testing #{scenario}" \ - " for a target of #{target_ng} with conc #{concentration} and vol #{measured_volume}" + "for a target of #{target_ng} with conc #{concentration} and vol #{measured_volume}" ) do - it "output stock_to_pick #{stock_to_pick}" do - expect(@target_well.well_attribute.picked_volume.round(2)).to eq(stock_to_pick) + it "output source pick volume of #{source_pick_vol}" do + expect(@target_well.well_attribute.picked_volume.round(2)).to eq(source_pick_vol) end - it "output buffer #{buffer_added}" do + it "output buffer of #{buffer_added}" do expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) end