app/views/courses/_refresh_report.html.erb
<% unless report.status == "crashed" %>
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4 class="success">Refresh successful.</h4>
<% else %>
<div class="alert alert-danger alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4>Refresh failed and rolled back.</h4>
<% end %>
<% if report.course_template_refresh_report['refresh_errors'].any? %>
<div class="alert alert-danger alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<ul>
<% for error in report.course_template_refresh_report['refresh_errors'] %>
<li><%= simple_format error, {}, wrapper_tag: 'span' %></li>
<% end %>
</ul>
</div>
<% end %>
<% if report.course_template_refresh_report['refresh_warnings'].any? %>
<div class="alert alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<ul>
<% for warning in report.course_template_refresh_report['refresh_warnings'] %>
<li><%= simple_format warning, {}, wrapper_tag: 'span' %></li>
<% end %>
</ul>
</div>
<% end %>
<% if report.course_template_refresh_report['refresh_notices'].any? %>
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<ul>
<% for notice in report.course_template_refresh_report['refresh_notices'] %>
<li><%= simple_format notice, {}, wrapper_tag: 'span' %></li>
<% end %>
</ul>
</div>
<% end %>
<% if report.course_template_refresh_phases.any? %>
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4>Background task phases</h4>
<table class="table borderless">
<thead>
<tr>
<th>Step</th>
<th class="align-right">Cumulative Time (ms)</th>
</tr>
</thead>
<tbody>
<% for phase in report.course_template_refresh_phases %>
<tr>
<td class="py-1"><%= simple_format phase.phase_name, {}, wrapper_tag: 'span' %></td>
<td class="py-1 align-right"><%= phase.time_ms %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
<% if report.course_template_refresh_report['refresh_timings'].any? %>
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4>Time used to update database</h4>
<table class="table borderless">
<thead>
<tr>
<th>Step</th>
<th class="align-right">Time per phase (s)</th>
</tr>
</thead>
<tbody>
<% report.course_template_refresh_report['refresh_timings'].each do |k,v| %>
<tr>
<td class="py-1"><%= simple_format k.to_s.split("_").join(" ").capitalize(), {}, wrapper_tag: 'span' %></td>
<td class="py-1 align-right"><%= "%.3f" % v["real"] %></td>
<% end %>
</tbody>
</table>
</div>
<% end %>
</div>
<hr />