Class: BulkOps::QueueWorkIngestsJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/bulk_ops/queue_work_ingests_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#operationObject

Returns the value of attribute operation.



2
3
4
# File 'lib/bulk_ops/queue_work_ingests_job.rb', line 2

def operation
  @operation
end

Instance Method Details

#perform(op) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bulk_ops/queue_work_ingests_job.rb', line 6

def perform(op)
  @operation = op
   = op.final_spreadsheet
  op.work_proxies.where(status:'queued').each do |proxy|
    data = proxy.interpret_data([proxy.row_number])
    next unless proxy.proxy_errors.blank?
    proxy.update(status: 'sidekiq', message: "interpreted at #{DateTime.now.strftime("%d/%m/%Y %H:%M")} " + proxy.message)
    BulkOps::CreateWorkJob.perform_later(proxy.work_type || "Work",
                                         op.user.email,
                                         data,
                                         proxy.id,
                                         proxy.visibility)
  end
end