From e167fb9a95ca728a008bd0ecc174f18ed5537b97 Mon Sep 17 00:00:00 2001 From: mode-x Date: Sat, 12 Oct 2019 19:23:21 +0100 Subject: [PATCH] Fix for record not found --- app/controllers/progress_job/progress_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/progress_job/progress_controller.rb b/app/controllers/progress_job/progress_controller.rb index ae645d1..fae55c6 100644 --- a/app/controllers/progress_job/progress_controller.rb +++ b/app/controllers/progress_job/progress_controller.rb @@ -3,9 +3,10 @@ class ProgressController < ActionController::Base def show @delayed_job = Delayed::Job.find(params[:job_id]) - return unless @delayed_job.present? 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 + rescue + @delayed_job = {} end end