app/views/admin/reports/solar_panels/index.html.erb
<% content_for :page_title, 'Solar Panel Report' %>
<h1>Solar Panel Summary</h1>
<ul>
<li><a href="#metered-solar">Metered solar</a></li>
<li><a href="#estimated-solar">Estimated solar (Sheffield synthetic data)</a></li>
</ul>
<h2 id="metered-solar">Metered Solar</h2>
<p>
This table lists all <strong><%= @metered_solar.uniq(&:school_id).count %></strong> active schools that have a
<code>solar_pv_meter_mapping</code> attribute that configures their real solar metering. There is one row per
attribute, so a school may be present multiple times if they have separate
arrays, e.g. on different meters.
</p>
<div class="row">
<table class="table table-sorted">
<thead>
<tr>
<th>School</th>
<th>Meter</th>
<th>Start date</th>
<th>End date</th>
<th>Export MPAN</th>
<th>Production MPANs</th>
<th></th>
</tr>
</thead>
<tbody>
<% @metered_solar.each do |solar_panel_config| %>
<tr>
<td><%= link_to(solar_panel_config.school_name, school_path(solar_panel_config.meter.school)) %></td>
<td><%= link_to(solar_panel_config.meter.display_name,
school_meter_path(solar_panel_config.meter.school, solar_panel_config.meter)) %></td>
<td><%= solar_panel_config.start_date %></td>
<td><%= solar_panel_config.end_date %></td>
<td><%= solar_panel_config.export_mpan %></td>
<td>
<ul class="list-unstyled">
<% solar_panel_config.production_mpans.each do |mpan| %>
<li><%= mpan %></li>
<% end %>
</ul>
</td>
<td>
<div class="btn-group">
<%= link_to 'Edit', edit_admin_school_meter_attribute_path(solar_panel_config.meter.school,
id: solar_panel_config.meter_attribute_id),
class: 'btn btn-sm' %>
<%= link_to('History', admin_school_meter_attribute_path(solar_panel_config.meter.school,
id: solar_panel_config.meter_attribute_id),
class: 'btn btn-sm') %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<h2 id="estimated-solar">Estimated Solar</h2>
<p>
This report lists all <strong><%= @estimated_solar.uniq(&:school_id).count %></strong> active schools with
a <code>solar_pv</code> meter attribute. We use this configuration to estimate the school's solar power generation
using data from Sheffield University.
</p>
<p>
Solar panel overrides, which are used to substitute data where we have actual
meter solar data are not included here.
</p>
<p>
Schools might have both metered and estimated solar so may be present in both tables. The <code>solar_pv</code>
attribute is also sometimes combined with the <code>solar_pv_meter_mapping</code> attribute.
</p>
<div class="row">
<table class="table table-sorted">
<thead>
<tr>
<th>School</th>
<th>Meter</th>
<th>Start date</th>
<th>End date</th>
<th>kWp</th>
<th></th>
</tr>
</thead>
<tbody>
<% @estimated_solar.each do |solar_panel_config| %>
<tr>
<td><%= link_to(solar_panel_config.school_name, school_path(solar_panel_config.meter.school)) %></td>
<td><%= link_to(solar_panel_config.meter.display_name, school_meter_path(solar_panel_config.meter.school,
solar_panel_config.meter)) %></td>
<td><%= solar_panel_config.start_date %></td>
<td><%= solar_panel_config.end_date %></td>
<td><%= solar_panel_config.kwp %></td>
<td>
<div class="btn-group">
<%= link_to 'Edit', edit_admin_school_meter_attribute_path(solar_panel_config.meter.school,
id: solar_panel_config.meter_attribute_id),
class: 'btn btn-sm' %>
<%= link_to('History', admin_school_meter_attribute_path(solar_panel_config.meter.school,
id: solar_panel_config.meter_attribute_id),
class: 'btn btn-sm') %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>