Module: Plate::PoolingMetadata

Included in:
Plate
Defined in:
app/models/plate/pooling_metadata.rb

Instance Method Summary collapse

Instance Method Details

#poolsObject

TODO: When API v1 is removed, this could stop returning the pool_id as v2 is only using the location arrays. When that happens, the v2 Resource would need to stop extracting those arrays from this hash. Returns a hash from the submission for the pools to the wells that form that pool on this plate. This is not necessarily efficient but it is correct. Unpooled wells, those without submissions, are completely ignored within the returned result.



9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/plate/pooling_metadata.rb', line 9

def pools
  Request
    .
    .for_pooling_of(self)
    .each_with_object({}) do |request, pools|
      pools[request.pool_id] = {
        wells: request.pool_into.split(','),
        pool_complete: request.pool_complete == 1
      }.tap { |pool_information| request.update_pool_information(pool_information) } unless request.pool_id.nil?
    end
end