Class: BulkActionRevertJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/bulk_action_revert_job.rb

Overview

BulkActionRevertJob

Instance Method Summary collapse

Instance Method Details

#perform(bulk_action) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/jobs/bulk_action_revert_job.rb', line 7

def perform(bulk_action)
  action = case bulk_action.field_name
  when "Publication State"
    logger.debug("BulkAction: Revert Publication Status")
    :revert_publication_status
  when "Delete"
    logger.debug("BulkAction: Revert Delete")
    :revert_delete
  else
    logger.debug("BulkAction: Revert Field Value")
    :revert_field_value
  end

  bulk_action.documents.each do |doc|
    BulkActionRevertDocumentJob.perform_later(action, doc)
    doc.state_machine.transition_to!(:queued)
  end
end