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, #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, plate_purpose, child_plate, user) ⇒ Object



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

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



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

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