BathHacked/energy-sparks

View on GitHub
app/views/admin/amr_uploaded_readings/_warnings.html.erb

Summary

Maintainability
Test Coverage
<h4>Warnings</h4>
<p>
  The following table shows the first ten warnings generated by the loader.
</p>
<div class="table-responsive">
  <table class="table table-striped table-bordered">
    <thead>
      <tr>
        <th>Mpan Mprn</th>
        <th>Reading Date</th>
        <th colspan="48">Readings</th>
      </tr>
    </thead>
    <tbody>
      <% warnings.each do |row| %>
        <tr>
          <td><%= row["mpan_mprn"] %></td>
          <td><%= row["reading_date"] %></td>
          <% row["readings"].each do |reading| %>
            <td><%= reading %></td>
          <% end %>
        </tr>
        <tr>
          <td class="alert alert-warning" colspan="<%= row["readings"].size + 2 %>"><%= row["warnings"].map { |w| AmrReadingData::WARNINGS[w.to_sym] }.join(', ') %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>