BathHacked/energy-sparks

View on GitHub
app/views/admin/schools/meter_collections/index.html.erb

Summary

Maintainability
Test Coverage
<% content_for :page_title do %>Meter Collections<% end %>

<h1>Download meter collections</h1>
<p>You can now download the aggregated meter collection for a school in YAML format, this includes all of the meter data, temperature data, holidays, Solar PV, irradiance and carbon grid data. This may take a long time to download, for schools with many meters, it is best to visit the school's page first so that the data is already in the cache.</p>

<p><%= link_to 'Reports index', admin_reports_path, class: 'btn btn-success' %></p>

<table class="table table-striped">
  <thead>
    <tr>
      <th>School name</th>
      <th>Downloads</th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @school_groups.each do |school_group| %>
      <tr class='table-active'>
        <td colspan="4" id="school-group-<%= school_group.id %>"><strong><%= school_group.name %></strong></td>
      </tr>
      <% school_group.schools.by_name.each do |school| %>
        <tr>
          <td><%= school.name %></td>
          <td><%= link_to 'Unvalidated meter data', admin_school_unvalidated_amr_data_path(school, format: :yaml), class: 'btn btn-sm' %></td>
          <td><%= link_to 'Validated meter data', admin_school_validated_amr_data_path(school, format: :yaml), class: 'btn btn-sm' %></td>
          <td><%= link_to 'Aggregated meter collection', admin_school_aggregated_meter_collection_path(school, format: :yaml), class: 'btn btn-sm' %></td>
        </tr>
      <% end %>
    <% end %>
  </tbody>
</table>