From 52f0c22a42444d1db0648870ae42f918bd3f63c1 Mon Sep 17 00:00:00 2001 From: radhika Date: Mon, 22 Sep 2014 14:26:46 -0400 Subject: [PATCH] 3381: do not convert percentages into integers by using ceil. When we do this, we are sometimes ending up with percentage sum of > 100%. --- .../views/application/_job_progress.html.erb | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/apps/workbench/app/views/application/_job_progress.html.erb b/apps/workbench/app/views/application/_job_progress.html.erb index f942c44c2c..49ba39d450 100644 --- a/apps/workbench/app/views/application/_job_progress.html.erb +++ b/apps/workbench/app/views/application/_job_progress.html.erb @@ -21,24 +21,9 @@ if defined? scaleby percent_total_tasks *= scaleby end - failed_percent = (failed * percent_total_tasks).ceil - success_percent = (done * percent_total_tasks).ceil - running_percent = (running * percent_total_tasks).ceil - - # We used ceil instead of round to compute percents to handle the situation - # where one of them is much larger than the other(s). However, this may - # have resulted in total percent > 100, hence we need to account for that. - if (failed_percent + success_percent + running_percent) > 100 - overflow = failed_percent + success_percent + running_percent - 100 - # decrease the biggest by the overlow amount - if (failed_percent > success_percent) && (failed_percent > running_percent) - failed_percent -= overflow - elsif (success_percent > failed_percent) && (success_percent > running_percent) - success_percent -= overflow - else - running_percent -= overflow - end - end + failed_percent = failed * percent_total_tasks + success_percent = done * percent_total_tasks + running_percent = running * percent_total_tasks end %> -- 2.30.2