% if (j.andand[:state] == "Running" or defined? scaleby) and (not defined? show_progress_bar or show_progress_bar) %> <% failed = j[:tasks_summary][:failed] || 0 rescue 0 done = j[:tasks_summary][:done] || 0 rescue 0 running = j[:tasks_summary][:running] || 0 rescue 0 todo = j[:tasks_summary][:todo] || 0 rescue 0 if done + running + failed + todo == 0 # No tasks were ever created for this job; # render an empty progress bar. done_percent = 0 else percent_total_tasks = 100.0 / (done + running + failed + todo) if defined? scaleby percent_total_tasks *= scaleby end done_percent = (done+failed) * percent_total_tasks end %> <% if not defined? scaleby %>