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?

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


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

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


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

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

#set_qc_state_pendingObject


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

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