Module: LabwareCreators::RequireWellsWithCollectedBy

Extended by:
ActiveSupport::Concern
Included in:
CardinalPoolsPlate
Defined in:
app/models/concerns/labware_creators/require_wells_with_collected_by.rb

Overview

Can be included in plate creators which requires well aliquots to have collected_by sample metadata

Instance Method Summary collapse

Instance Method Details

#wells_with_aliquots_must_have_collected_byObject

Validation method that can be called to check that all wells, with aliquots, have an associated sample metadata, with collected_by.



9
10
11
12
13
14
15
# File 'app/models/concerns/labware_creators/require_wells_with_collected_by.rb', line 9

def wells_with_aliquots_must_have_collected_by
  invalid_well_locations = wells_with_missing_collected_by
  return if invalid_well_locations.empty?

  msg = 'wells missing collected_by sample metadata:'
  errors.add(:source_plate, "#{msg} #{invalid_well_locations.join(', ')}")
end