BathHacked/energy-sparks

View on GitHub
app/views/schools/advice/gas_costs/_meter.html.erb

Summary

Maintainability
Test Coverage
<%= component 'chart', chart_type: one_year_breakdown_chart, analysis_controls: true, school: school, chart_config: create_chart_config(school, one_year_breakdown_chart, mpan_mprn) do |c| %>
  <% c.with_title { advice_t("gas_costs.charts.#{one_year_breakdown_chart_key}.meter_title", meter: label) } %>
  <% c.with_subtitle { advice_t("gas_costs.charts.#{one_year_breakdown_chart_key}.meter_subtitle_html", end_date: analysis_dates.end_date.to_fs(:es_short)) } %>
<% end %>

<%= component 'meter_costs_table', monthly_costs: monthly_costs, change_in_costs: change_in_costs %>

<% if local_assigns[:tariffs] %>
  <%= render 'tariff_summary_table', school: school, tariffs: tariffs %>
  <div class="text-right">
    <%= t('schools.user_tariffs.view_and_manage_tariffs_html', user_tariffs_path: school_energy_tariffs_path(school)) %>
  </div>
<% end %>

<% if analysis_dates.months_of_data > 23 %>
  <%= component 'chart', chart_type: :electricity_cost_comparison_last_2_years_accounting, analysis_controls: true, school: school, chart_config: create_chart_config(school, :electricity_cost_comparison_last_2_years_accounting, mpan_mprn) do |c| %>
    <% c.with_title { advice_t('gas_costs.charts.cost_comparison_last_2_years_accounting.meter_title', meter: label) } %>
    <% c.with_subtitle { advice_t('gas_costs.charts.cost_comparison_last_2_years_accounting.subtitle_html', end_date: analysis_dates.end_date.to_fs(:es_short)) } %>
  <% end %>
<% end %>