Class: ProvenanceEvent

Inherits:
ApplicationRecord show all
Defined in:
app/models/provenance_event.rb

Constant Summary collapse

SUBMISSION_EVENT_TYPE =
"Submission"
APPROVAL_EVENT_TYPE =
"Approved"
ACTIVE_EVENT_TYPE =
"Active"
STATUS_UPDATE_EVENT_TYPE =
"Status Update"

Class Method Summary collapse

Class Method Details

.generate_active_events(project:, user:) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/provenance_event.rb', line 36

def self.generate_active_events(project:, user:)
  project.provenance_events.create(
    event_type: ProvenanceEvent::ACTIVE_EVENT_TYPE,
    event_person: user.uid,
    event_details: "Activated by Tigerdata Staff"
  )
  project.provenance_events.create(
    event_type: ProvenanceEvent::STATUS_UPDATE_EVENT_TYPE,
    event_person: user.uid,
    event_details: "The Status of this project has been set to active"
  )
end

.generate_approval_events(project:, user:) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/provenance_event.rb', line 22

def self.generate_approval_events(project:, user:)
  project.provenance_events.create(
    event_type: ProvenanceEvent::APPROVAL_EVENT_TYPE,
    event_person: user.uid,
    event_details: "Approved by #{user.display_name_safe}",
    event_note: project..approval_note
  )
  project.provenance_events.create(
    event_type: ProvenanceEvent::STATUS_UPDATE_EVENT_TYPE,
    event_person: user.uid,
    event_details: "The Status of this project has been set to approved"
  )
end

.generate_submission_events(project:, user:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/provenance_event.rb', line 9

def self.generate_submission_events(project:, user:)
  project.provenance_events.create(
    event_type: ProvenanceEvent::SUBMISSION_EVENT_TYPE,
    event_person: user.uid,
    event_details: "Requested by #{user.display_name_safe}"
  )
  project.provenance_events.create(
    event_type: ProvenanceEvent::STATUS_UPDATE_EVENT_TYPE,
    event_person: user.uid,
    event_details: "The Status of this project has been set to pending"
  )
end