diff --git a/app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb b/app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb index 6fe11254fe..ee0b535160 100644 --- a/app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb +++ b/app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true module Submission::ScrnaCoreCdnaPrepFeasibilityCalculator - def calculate_full_allowance(number_of_cells_per_chip_well) # "Full allowance" = ( "Chip loading volume" * 2) + 25 # 2 is because this is for 2 runs @@ -12,7 +11,6 @@ def calculate_full_allowance(number_of_cells_per_chip_well) scrna_config[:wastage_volume] end - def calculate_chip_loading_volume(number_of_cells_per_chip_well) # "Chip loading volume" = "Number of cells per chip well" / "Chip loading concentration" number_of_cells_per_chip_well / scrna_config[:desired_chip_loading_concentration] diff --git a/app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb b/app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb index 9af9b4409b..5b816c91e7 100644 --- a/app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb +++ b/app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb @@ -2,7 +2,6 @@ # rubocop:disable Metrics/ModuleLength module Submission::ScrnaCoreCdnaPrepFeasibilityValidator - include Submission::ScrnaCoreCdnaPrepFeasibilityCalculator HEADER_BARCODE = 'barcode' unless defined?(HEADER_BARCODE) @@ -168,22 +167,38 @@ def validate_scrna_core_cdna_prep_full_allowance final_resuspension_volume = calculate_resuspension_volume(number_of_samples_in_smallest_pool) full_allowance = calculate_full_allowance(number_of_cells_per_chip_well) - return if final_resuspension_volume >= full_allowance - - warnings.add( - :spreadsheet, - I18n.t( - 'warnings.full_allowance', - study_name: study_name, - project_name: project_name, - number_of_samples_in_smallest_pool: number_of_samples_in_smallest_pool, - final_resuspension_volume: final_resuspension_volume, - full_allowance: full_allowance - ) + next if final_resuspension_volume >= full_allowance + + add_warning_scrna_core_cdna_prep_full_allowance( + study_name, + project_name, + number_of_samples_in_smallest_pool, + final_resuspension_volume, + full_allowance ) end end + def add_warning_scrna_core_cdna_prep_full_allowance( + study_name, + project_name, + number_of_samples_in_smallest_pool, + final_resuspension_volume, + full_allowance + ) + warnings.add( + :spreadsheet, + I18n.t( + 'warnings.full_allowance', + study_name:, + project_name:, + number_of_samples_in_smallest_pool:, + final_resuspension_volume:, + full_allowance: + ) + ) + end + def calculate_number_of_samples_in_smallest_pool(rows) barcodes, well_locations = extract_barcodes_and_well_locations(rows) number_of_samples = calculate_total_number_of_samples(barcodes, well_locations)