Sha256: af1c862a7c23ad174c2ccd12cfedaca1baeeee12c26916bfb16619e874184de0

Contents?: true

Size: 713 Bytes

Versions: 4

Compression:

Stored size: 713 Bytes

Contents

# frozen_string_literal: true

# BulkActionRunJob
class BulkActionRunJob < ApplicationJob
  queue_as :default

  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.3.0 app/jobs/bulk_action_run_job.rb
geoblacklight_admin-0.2.1 app/jobs/bulk_action_run_job.rb
geoblacklight_admin-0.1.0 app/jobs/bulk_action_run_job.rb
geoblacklight_admin-0.0.1 app/jobs/bulk_action_run_job.rb