Class: Event::ScannedIntoLabEvent

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

Class Method Summary collapse

Instance 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_for_asset!(asset, location_barcode, created_by) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'app/models/event/scanned_into_lab_event.rb', line 6

def self.create_for_asset!(asset, location_barcode, created_by)
  create!(
    eventful: asset,
    message: "Scanned into #{location_barcode}",
    content: Date.today.to_s,
    family: 'scanned_into_lab',
    created_by: created_by
  )
end

Instance Method Details

#qc_state_not_final?Boolean

Returns:

  • (Boolean)


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

def qc_state_not_final?
  asset.respond_to?(:receptacle) && %w[passed failed].exclude?(asset.receptacle.qc_state)
end

#set_qc_state_pendingObject



16
17
18
19
# File 'app/models/event/scanned_into_lab_event.rb', line 16

def set_qc_state_pending
  asset.receptacle.qc_state = 'pending'
  asset.receptacle.save!
end