<commit_before>module Schools
  class ProgressService
    def initialize(school, aggregated_school)
      @school = school
      @aggregated_school = aggregated_school
    end

    def electricity_progress
      @school.has_electricity? ? progress(:electricity) : nil
    end

    def gas_progress
      @school.has_gas? ? progress(:gas) : nil
    end

    def storage_heater_progress
      @school.has_storage_heaters? ? progress(:storage_heaters) : nil
    end

    #TEMPORARY
    def setup_management_table
      table = @school.latest_management_dashboard_tables.first.table
      table.each do |row|
        row.insert(-2, "Target progress") if row[0] == ""
        row.insert(-2, FormatEnergyUnit.format(:relative_percent, electricity_progress, :html, false, true, :target)) if row[0] == "Electricity"
        row.insert(-2, FormatEnergyUnit.format(:relative_percent, gas_progress, :html, false, true, :target)) if row[0] == "Gas"
      end
    end

    private
<commit_msg>Add feature flag<commit_after>module Schools
  class ProgressService
    def initialize(school, aggregated_school)
      @school = school
      @aggregated_school = aggregated_school
    end

    def electricity_progress
      @school.has_electricity? ? progress(:electricity) : nil
    end

    def gas_progress
      @school.has_gas? ? progress(:gas) : nil
    end

    def storage_heater_progress
      @school.has_storage_heaters? ? progress(:storage_heaters) : nil
    end

    #TEMPORARY
    def setup_management_table
      table = @school.latest_management_dashboard_tables.first.table
      return table unless EnergySparks::FeatureFlags.active?(:school_targets)
      table.each do |row|
        row.insert(-2, "Target progress") if row[0] == ""
        row.insert(-2, FormatEnergyUnit.format(:relative_percent, electricity_progress, :html, false, true, :target)) if row[0] == "Electricity"
        row.insert(-2, FormatEnergyUnit.format(:relative_percent, gas_progress, :html, false, true, :target)) if row[0] == "Gas"
      end
    end

    private

{'fraction_non_alphanumeric': 0.10142087212150906, 'fraction_numerical': 0.005879470847623714, 'mean_word_length': 3.4780701754385963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1069835', 'n_tokens_mistral': 623, 'n_tokens_neox': 596, 'n_words': 138}