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, #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

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Class Method Details

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



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

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

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



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

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