From ef811af14a90a6ab8703cf66c82007f757355ae5 Mon Sep 17 00:00:00 2001 From: Ashton South Date: Fri, 25 Oct 2024 08:18:49 -0400 Subject: [PATCH] handle case where job is already completed but not updated on page --- apps/dashboard/app/controllers/projects_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/app/controllers/projects_controller.rb b/apps/dashboard/app/controllers/projects_controller.rb index 77b779895..ca12aae88 100644 --- a/apps/dashboard/app/controllers/projects_controller.rb +++ b/apps/dashboard/app/controllers/projects_controller.rb @@ -118,9 +118,14 @@ def job_details def delete_job project = Project.find(job_details_params[:project_id]) cluster_str = job_details_params[:cluster].to_s + hpc_job = project.job(job_details_params[:jobid].to_s, cluster_str) - project.remove_logged_job(job_details_params[:jobid].to_s, cluster_str) - redirect_to project_path(job_details_params[:project_id]) + if hpc_job.status.to_s == 'completed' + redirect_to project_path(job_details_params[:project_id]) if hpc_job.status.to_s == 'completed' + else + project.remove_logged_job(job_details_params[:jobid].to_s, cluster_str) + redirect_to project_path(job_details_params[:project_id]) + end end # PATCH /projects/:project_id/jobs/:cluster/:jobid/stop