Class: ExternalReleaseEvent

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

#request?

Methods included from Event::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

Instance Attribute Details

#send_emailObject

Returns the value of attribute send_email


5
6
7
# File 'app/models/external_release_event.rb', line 5

def send_email
  @send_email
end

Class Method Details

.create_for_asset!(asset, sendmail = false) ⇒ Object


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

def self.create_for_asset!(asset, sendmail = false)
  create!(
    eventful: asset,
    message: "Data to be released externally set #{asset.external_release}",
    created_by: '', family: 'update', of_interest_to: 'administrators',
    send_email: sendmail
  )
end

Instance Method Details

#physically_send_emailObject


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

def physically_send_email
  studies = eventful.studies
  users = studies.reduce([]) { |users, study| users.concat(study.mailing_list_of_managers.reject(&:blank?)) }
  return false if users.empty?

  EventfulMailer.confirm_external_release_event(users.uniq, eventful, message, content, 'No Milestone').deliver_now
end

#set_qc_stateObject


16
17
18
# File 'app/models/external_release_event.rb', line 16

def set_qc_state
  # This method should be empty!
end