<commit_before>class Champs::CarteChamp < Champ
  has_many :geo_areas, foreign_key: :champ_id, dependent: :destroy

  # We are not using scopes here as we want to access
  # the following collections on unsaved records.
  def cadastres
    geo_areas.select do |area|
      area.source == GeoArea.sources.fetch(:cadastre)
    end
  end

  def quartiers_prioritaires
    geo_areas.select do |area|
      area.source == GeoArea.sources.fetch(:quartier_prioritaire)
    end
  end

  def position
    if dossier.present?
      dossier.geo_position
    else<commit_msg>Add type options on carte champ<commit_after>class Champs::CarteChamp < Champ
  has_many :geo_areas, foreign_key: :champ_id, dependent: :destroy

  # We are not using scopes here as we want to access
  # the following collections on unsaved records.
  def cadastres
    geo_areas.select do |area|
      area.source == GeoArea.sources.fetch(:cadastre)
    end
  end

  def quartiers_prioritaires
    geo_areas.select do |area|
      area.source == GeoArea.sources.fetch(:quartier_prioritaire)
    end
  end

  def cadastres?
    type_de_champ&.cadastres && type_de_champ.cadastres != '0'
  end

  def quartiers_prioritaires?
    type_de_champ&.quartiers_prioritaires && type_de_champ.quartiers_prioritaires != '0'
  end

  def position
    if dossier.present?
      dossier.geo_position
    else
{'fraction_non_alphanumeric': 0.07516580692704496, 'fraction_numerical': 0.0014738393515106854, 'mean_word_length': 3.5878378378378377, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6322265', 'n_tokens_mistral': 487, 'n_tokens_neox': 451, 'n_words': 116}