2 failed = j[:tasks_summary][:failed] || 0 rescue 0
3 done = j[:tasks_summary][:done] || 0 rescue 0
4 running = j[:tasks_summary][:running] || 0 rescue 0
5 todo = j[:tasks_summary][:todo] || 0 rescue 0
7 if j[:success] == false and done + running + failed == 0
8 # The job failed but no tasks were ever started (i.e. crunch-dispatch
9 # was unable to start the job). Display a full 100% failed progress bar.
13 elsif done + running + failed + todo == 0
14 # No tasks were ever created for this job;
15 # render an empty progress bar.
20 percent_total_tasks = 100.0 / (done + running + failed + todo)
22 percent_total_tasks *= scaleby
24 failed_percent = (failed * percent_total_tasks).ceil
25 success_percent = (done * percent_total_tasks).ceil
26 running_percent = (running * percent_total_tasks).ceil
30 <% if not defined? scaleby %>
31 <div class="progress">
34 <span class="progress-bar progress-bar-success" style="width: <%= success_percent %>%;">
36 <span class="progress-bar progress-bar-danger" style="width: <%= failed_percent %>%;">
38 <span class="progress-bar" style="width: <%= running_percent %>%;">
41 <% if not defined? scaleby %>