<commit_before>module PlayersHelper
  def category_icon(player)
    if player.status_ok?
      image = case player.category
              when "icu_player"     then "user_green"
              when "foreign_player" then "user_blue"
              when "new_player"     then "user_orange"
              else "user_red"  # shouldn't happen
              end
      alt = player.category.present? ? t(player.category) : "Unknown"
    else
      image = "flag_red"
      alt = "Problem"
    end
    icon_tag image, alt
  end

  def explain_trn_rating(player)
    ave = round(player.ave_opp_rating, 1)
    gms = player.rateable_games
    scr = round(player.rateable_score, 1)
    ans = "#{ave} &plus; 400 &times; (2 &times; #{scr} &minus; #{gms})"
    ans << " &divide; #{gms}" unless gms == 1
    ans.html_safe
  end

  def explain_full_change(player)
    ans = "(#{player.actual_score} &minus; #{round(player.expected_score)}) &times; #{player.k_factor}"
    ans << " &plus; #{player.bonus}" unless player.bonus.to_i == 0
    ans.html_safe
  end

  def explain_full_rating(player)
    "#{player.old_rating} #{sign(player.rating_change, space: true)}"
  end

  def explain_full_games(player)
    "#{player.old_games} &plus; #{player.rateable_games}".html_safe
  end

  def explain_provisional_rating(player)
    r1, g1 = player.old_rating, player.old_games
    r2, g2 = player.performance_rating, player.rateable_games
    "(#{r1} &times; #{g1} &plus; #{round(r2, 1)} &times; #{g2}) &divide; (#{g1} &plus; #{g2})".html_safe
  end

  def explain_provisional_change(player)
    "#{player.new_rating} &minus; #{player.old_rating}".html_safe
  end

  def explain_provisional_games(player)
    type = player.new_full ? "now full" : "still provisional"
    "#{player.old_games} &plus; #{player.rateable_games} (rating is #{type})".html_safe
  end

  def explain_new_rating(player)
    explain_trn_rating(player)
  end

  def explain_new_games(player)
    type = player.new_full ? "full" : "provisional"
    "rating is #{type}"
  end
end<commit_msg>There is no "plus" HTML entity<commit_after>module PlayersHelper
  def category_icon(player)
    if player.status_ok?
      image = case player.category
              when "icu_player"     then "user_green"
              when "foreign_player" then "user_blue"
              when "new_player"     then "user_orange"
              else "user_red"  # shouldn't happen
              end
      alt = player.category.present? ? t(player.category) : "Unknown"
    else
      image = "flag_red"
      alt = "Problem"
    end
    icon_tag image, alt
  end

  def explain_trn_rating(player)
    ave = round(player.ave_opp_rating, 1)
    gms = player.rateable_games
    scr = round(player.rateable_score, 1)
    ans = "#{ave} + 400 &times; (2 &times; #{scr} &minus; #{gms})"
    ans << " &divide; #{gms}" unless gms == 1
    ans.html_safe
  end

  def explain_full_change(player)
    ans = "(#{player.actual_score} &minus; #{round(player.expected_score)}) &times; #{player.k_factor}"
    ans << " + #{player.bonus}" unless player.bonus.to_i == 0
    ans.html_safe
  end

  def explain_full_rating(player)
    "#{player.old_rating} #{sign(player.rating_change, space: true)}"
  end

  def explain_full_games(player)
    "#{player.old_games} + #{player.rateable_games}".html_safe
  end

  def explain_provisional_rating(player)
    r1, g1 = player.old_rating, player.old_games
    r2, g2 = player.performance_rating, player.rateable_games
    "(#{r1} &times; #{g1} + #{round(r2, 1)} &times; #{g2}) &divide; (#{g1} + #{g2})".html_safe
  end

  def explain_provisional_change(player)
    "#{player.new_rating} &minus; #{player.old_rating}".html_safe
  end

  def explain_provisional_games(player)
    type = player.new_full ? "now full" : "still provisional"
    "#{player.old_games} + #{player.rateable_games} (rating is #{type})".html_safe
  end

  def explain_new_rating(player)
    explain_trn_rating(player)
  end

  def explain_new_games(player)
    type = player.new_full ? "full" : "provisional"
    "rating is #{type}"
  end
end
{'fraction_non_alphanumeric': 0.13408922849396104, 'fraction_numerical': 0.009366526990386986, 'mean_word_length': 3.3540772532188843, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6860943', 'n_tokens_mistral': 1474, 'n_tokens_neox': 1415, 'n_words': 310}