+ if j[:success] == false and done + running + failed == 0
+ # The job failed but no tasks were ever started (i.e. crunch-dispatch
+ # was unable to start the job). Display a full 100% failed progress bar.
+ failed_percent = 100
+ success_percent = 0
+ running_percent = 0
+ elsif done + running + failed + todo == 0
+ # No tasks were ever created for this job;
+ # render an empty progress bar.
+ failed_percent = 0
+ success_percent = 0
+ running_percent = 0
+ else
+ percent_total_tasks = 100.0 / (done + running + failed + todo)
+ 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
+ end
+%>