<% enqueued_at = workflow.enqueued_at %> <% run_at = workflow.run_at %> <% if workflow.root.enqueued? %> <%= erb sidekiq_hierarchy_template(:_progress_bar), locals: {bars: [[:enqueued, 1.0]]} %> <% elsif workflow.running? %> <% runtime = Time.now - enqueued_at %> <% enqueued_pct = (run_at - enqueued_at) / runtime %> <% run_pct = 1.0 - enqueued_pct %> <%= erb sidekiq_hierarchy_template(:_progress_bar), locals: {bars: [[:enqueued, enqueued_pct], [:running, run_pct]], active: true} %> <% elsif complete_at = workflow.complete_at %> <% runtime = complete_at - enqueued_at %> <% enqueued_pct = (run_at - enqueued_at) / runtime %> <% run_pct = 1.0 - enqueued_pct %> <%= erb sidekiq_hierarchy_template(:_progress_bar), locals: {bars: [[:enqueued, enqueued_pct], [:complete, run_pct]]} %> <% elsif failed_at = workflow.failed_at %> <% runtime = failed_at - enqueued_at %> <% enqueued_pct = (run_at - enqueued_at) / runtime %> <% failed_pct = 1.0 - enqueued_pct %> <%= erb sidekiq_hierarchy_template(:_progress_bar), locals: {bars: [[:enqueued, enqueued_pct], [:failed, failed_pct]]} %> <% end %>