BathHacked/energy-sparks

View on GitHub
app/views/schools/advice/long_term/_comparison.html.erb

Summary

Maintainability
Test Coverage
<%= render 'schools/advice/section_title',
           section_id: 'comparison',
           section_title: t("advice_pages.#{fuel_type}_long_term.insights.comparison.title") %>

<% if analysis_dates.one_years_data? %>
  <p>
    <%= t("advice_pages.#{fuel_type}_long_term.insights.comparison.how_do_you_compare",
          school_type: t("common.school_types.#{school.school_type}")) %>
  </p>

  <div class="col">
    <%= component 'school_comparison', id: "#{fuel_type}-comparison", comparison: @benchmarked_usage do |c| %>
      <% c.with_footer { advice_t("#{fuel_type}_long_term.insights.comparison.callout_footer") } %>
    <% end %>
  </div>
<% else %>
  <p>
    <%= t("advice_pages.#{fuel_type}_long_term.insights.comparison.less_than_a_year",
          available_date: analysis_dates.date_when_one_years_data.to_fs(:es_short)) %>
  </p>
  <p>
    <%= t("advice_pages.#{fuel_type}_long_term.insights.comparison.less_than_a_year_well_managed",
          usage: format_unit(benchmarked_usage.benchmark_value, :kwh)) %>
  </p>
<% end %>

<% if school.school_group.present? %>
  <p>
    <%= t("advice_pages.#{fuel_type}_long_term.insights.comparison.more_detail_html",
          link: compare_for_school_group_path(compare_benchmark_key_for(@advice_page.key.to_sym), school)) %>
  </p>
<% end %>