Class: SampleManifestAsset

Inherits:
ApplicationRecord show all
Defined in:
app/models/sample_manifest_asset.rb

Overview

Keeps track of sanger_sample_ids which have been allocated to a SampleManifest and associates them with the corresponding Receptacle

Instance Method Summary collapse

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#aliquotObject


21
22
23
# File 'app/models/sample_manifest_asset.rb', line 21

def aliquot
  asset.aliquots.detect { |a| a.sample_id == sample.id }
end

#find_or_create_sampleObject

Returns the existing sample, or generates a new one if it doesn't exist


17
18
19
# File 'app/models/sample_manifest_asset.rb', line 17

def find_or_create_sample
  self.sample ||= create_sample
end