Module: DualSourcedPool
- Extended by:
- ActiveSupport::Concern
- Included in:
- Ont::Pool
- Defined in:
- app/models/concerns/dual_sourced_pool.rb
Overview
Include in a pool record to provide a #source_identifier method based on source plates.
Instance Method Summary collapse
-
#source_identifier ⇒ String
Identifies the plate and wells from which the pool was created Typically in the format: DN123:A1-D1.
Instance Method Details
#source_identifier ⇒ String
Note:
Assumes 96 well plates. formatted_range can take a second argument
Identifies the plate and wells from which the pool was created Typically in the format: DN123:A1-D1. In the unlikely event we have multiple plates, will include them all of plate_size if this ever changes.
29 30 31 32 33 34 35 36 37 |
# File 'app/models/concerns/dual_sourced_pool.rb', line 29 def source_identifier formatted_wells = wells_grouped_by_container.map do |plate, wells| well_range = plate.formatted_range(wells.pluck(:position)) "#{plate.}:#{well_range}" end.join(',') formatted_tubes = source_tubes.pluck(:barcode).join(',') # Combines the two outputs checking neither are empty [formatted_wells, formatted_tubes].compact_blank.join(',') end |