<commit_before>class HomePresenter
  include ActionView::Helpers::NumberHelper

  def initialize
  end

  def terrestrial_pas
    @terrestrial_pas ||= number_with_delimiter(ProtectedArea.where(marine: false).count)
  end
  
  def marine_pas
    @marine_pas ||= number_with_delimiter(ProtectedArea.where(marine: true).count)
  end

  def terrestrial_oecms
    number_with_delimiter(ProtectedArea.where(marine: false, is_oecm: true).count)
  end

  def marine_oecms
    number_with_delimiter(ProtectedArea.where(marine: true, is_oecm: true).count)
  end

  def terrestrial_cover
    CountryStatistic.global_percentage_pa_land_cover
  end

  def marine_cover
    CountryStatistic.global_percentage_pa_marine_cover
  end

  def oecm_pa_land_cover
    Stats::Global.percentage_oecms_land_cover.round(2)
  end

  def oecm_pa_marine_cover
    Stats::Global.percentage_oecms_marine_cover.round(2)
  end
  
  def fact_card_stats
    [
      {
        percentage: terrestrial_cover,
        theme: I18n.t('home.facts')[0][:theme],
        title: I18n.t('home.facts')[0][:title],
        totals: [
          {
            number: terrestrial_pas,
            text: I18n.t('global.area-types.wdpa')
          }
        ]
      },
      {
        percentage: marine_cover,
        theme: I18n.t('home.facts')[1][:theme],
        title: I18n.t('home.facts')[1][:title],
        totals: [
          {
            number: marine_pas,
            text: I18n.t('global.area-types.oecm')
          }
        ]
      },
      {
        percentage: oecm_pa_land_cover,
        theme: I18n.t('home.facts')[2][:theme],
        title: I18n.t('home.facts')[2][:title],
        totals: [
          {
            number: terrestrial_pas,
            text: I18n.t('global.area-types.wdpa')
          },
          {
            number: terrestrial_oecms,
            text: I18n.t('global.area-types.oecm')
          }
        ]
      },
      {
        percentage: oecm_pa_marine_cover,
        theme: I18n.t('home.facts')[3][:theme],
        title: I18n.t('home.facts')[3][:title],
        totals: [
          {
            number: marine_pas,
            text: I18n.t('global.area-types.wdpa')
          },
          {
            number: marine_oecms,
            text: I18n.t('global.area-types.oecm')
          }
        ]
      }
    ]
  end
end<commit_msg>corrected OECMs on homepage fact cards to protected areas<commit_after>class HomePresenter
  include ActionView::Helpers::NumberHelper

  def initialize
  end

  def terrestrial_pas
    @terrestrial_pas ||= number_with_delimiter(ProtectedArea.where(marine: false).count)
  end
  
  def marine_pas
    @marine_pas ||= number_with_delimiter(ProtectedArea.where(marine: true).count)
  end

  def terrestrial_oecms
    number_with_delimiter(ProtectedArea.where(marine: false, is_oecm: true).count)
  end

  def marine_oecms
    number_with_delimiter(ProtectedArea.where(marine: true, is_oecm: true).count)
  end

  def terrestrial_cover
    CountryStatistic.global_percentage_pa_land_cover
  end

  def marine_cover
    CountryStatistic.global_percentage_pa_marine_cover
  end

  def oecm_pa_land_cover
    Stats::Global.percentage_oecms_land_cover.round(2)
  end

  def oecm_pa_marine_cover
    Stats::Global.percentage_oecms_marine_cover.round(2)
  end
  
  def fact_card_stats
    [
      {
        percentage: terrestrial_cover,
        theme: I18n.t('home.facts')[0][:theme],
        title: I18n.t('home.facts')[0][:title],
        totals: [
          {
            number: terrestrial_pas,
            text: I18n.t('global.area-types.wdpa')
          }
        ]
      },
      {
        percentage: marine_cover,
        theme: I18n.t('home.facts')[1][:theme],
        title: I18n.t('home.facts')[1][:title],
        totals: [
          {
            number: marine_pas,
            text: I18n.t('global.area-types.wdpa')
          }
        ]
      },
      {
        percentage: oecm_pa_land_cover,
        theme: I18n.t('home.facts')[2][:theme],
        title: I18n.t('home.facts')[2][:title],
        totals: [
          {
            number: terrestrial_pas,
            text: I18n.t('global.area-types.wdpa')
          },
          {
            number: terrestrial_oecms,
            text: I18n.t('global.area-types.oecm')
          }
        ]
      },
      {
        percentage: oecm_pa_marine_cover,
        theme: I18n.t('home.facts')[3][:theme],
        title: I18n.t('home.facts')[3][:title],
        totals: [
          {
            number: marine_pas,
            text: I18n.t('global.area-types.wdpa')
          },
          {
            number: marine_oecms,
            text: I18n.t('global.area-types.oecm')
          }
        ]
      }
    ]
  end
end
{'fraction_non_alphanumeric': 0.11799660441426146, 'fraction_numerical': 0.016129032258064516, 'mean_word_length': 2.0904918032786886, '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': '796439', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1629, 'n_words': 217}