1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00

Problem: When runtime is nil, a no method error is raised for round on nil:NilClass.

Solution: Use lonely operator to handle nil value for runtime and display N/A in these cases.
This commit is contained in:
Teresa Martyny 2016-04-14 20:40:12 -07:00
parent 6b3eb441e8
commit 59a217598a

View file

@ -23,10 +23,11 @@
<% @history.each do |entry| %>
<% entry = Sidekiq.load_json(entry).symbolize_keys %>
<% runtime = entry[:runtime]&.round(3) || "N/A" %>
<tr class="<%= 'error' if entry[:status] == 'failure' %>">
<td><%= entry[:status].capitalize %></td>
<td><%= Time.parse(entry[:timestamp]).strftime("%m/%d/%Y %I:%M:%S%p") %></td>
<td><%= entry[:runtime].round(3) %> s</td>
<td><%= runtime %> s</td>
<td>
<% if entry[:status] == 'failure' %>
<a class="backtrace" href="#" onclick="$(this).next().toggle(); return false">