Sha256: 87c602216ccfeeaeb2d2580bdbb37ba5169af3db16980f19f7c8a2428a42be9d

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true

# BulkActionRunJob
class BulkActionRunJob < ApplicationJob
  queue_as :priority

  def perform(bulk_action)
    action = case bulk_action.field_name
    when "Publication State"
      logger.debug("BulkAction: Update Publication Status")
      :update_publication_status
    when "Delete"
      logger.debug("BulkAction: Delete")
      :update_delete
    else
      :update_field_value
    end

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

    # Capture State
    bulk_action.state_machine.transition_to!(:queued)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geoblacklight_admin-0.4.1 app/jobs/bulk_action_run_job.rb
geoblacklight_admin-0.4.0 app/jobs/bulk_action_run_job.rb
geoblacklight_admin-0.3.2 app/jobs/bulk_action_run_job.rb
geoblacklight_admin-0.3.1 app/jobs/bulk_action_run_job.rb