Class: Event::PlateCreationEvent

Inherits:
Event show all
Defined in:
app/models/event/plate_creation_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_for_asset!(asset, plate_purpose, child_plate, user) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/event/plate_creation_event.rb', line 2

def self.create_for_asset!(asset, plate_purpose, child_plate, user)
  create!(
    eventful: asset,
    message: "Created child #{plate_purpose.name} plate",
    content: Date.today.to_s,
    family: "create_#{plate_purpose.class.name.underscore}",
    created_by: user ? user. : nil
  )
  create!(
    eventful: child_plate,
    message: "Created #{plate_purpose.name} plate",
    content: Date.today.to_s,
    family: "create_#{plate_purpose.class.name.underscore}",
    created_by: user ? user. : nil
  )
end

.create_for_asset_with_date!(asset, plate_purpose, parent_plate, date) ⇒ Object


19
20
21
22
23
24
25
26
# File 'app/models/event/plate_creation_event.rb', line 19

def self.create_for_asset_with_date!(asset, plate_purpose, parent_plate, date)
  create!(
    eventful: asset,
    message: "Created #{plate_purpose.name} from #{parent_plate.id}",
    content: date.to_s,
    family: "create_#{plate_purpose.class.name.underscore}"
  )
end