Class: Event::SampleLogisticsQcEvent

Inherits:
Event show all
Defined in:
app/models/event/sample_logistics_qc_event.rb

Class Method Summary collapse

Methods inherited from Event

#request?

Methods included from RequestDescriptorUpdateEvent

included, #library_creation_descriptor?, #pass_or_fail_event?, #set_request_metadata, #update_metadata_for_request

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

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

Class Method Details

.create_gel_qc_for_asset!(asset, result, user) ⇒ Object


2
3
4
5
6
7
8
# File 'app/models/event/sample_logistics_qc_event.rb', line 2

def self.create_gel_qc_for_asset!(asset, result, user)
  if asset.is_a?(Well)
    gel_qc_message(asset, "Gel Analysed for well #{asset.id} with #{result}", 'gel_analysed', user)
  elsif asset.is_a?(Plate)
    gel_qc_message(asset, 'Gel Analysed', 'gel_analysed', user)
  end
end

.gel_qc_message(asset, message, family, user) ⇒ Object


10
11
12
13
14
15
16
17
18
# File 'app/models/event/sample_logistics_qc_event.rb', line 10

def self.gel_qc_message(asset, message, family, user)
  create!(
    eventful: asset,
    message: message,
    content: Date.today.to_s,
    family: family,
    created_by: user ? user. : nil
  )
end