Class: ProgressJob::ProgressController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/progress_job/progress_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
# File 'app/controllers/progress_job/progress_controller.rb', line 4

def show
  @delayed_job = Delayed::Job.find(params[:job_id])
  percentage = !@delayed_job.progress_max.zero? ? @delayed_job.progress_current / @delayed_job.progress_max.to_f * 100 : 0
  render json: @delayed_job.attributes.merge!(percentage: percentage).to_json
end