<commit_before>class RankingsController < ApplicationController
  def index
    if %w(today this_week this_month all_time).include?(params[:time_period])
      @cache_expiration = expires_in(params[:time_period])
      @leaderboard = Kaminari.paginate_array(cached_leatherboard).page(params[:page])
    else
      not_found
    end
  end

  protected

  def cached_leatherboard
    Rails.cache.fetch([:user_ranking, params[:time_period]], :expires_in => @cache_expiration) do
      Tomato.ranking_collection(params[:time_period].to_sym)
      ranking_collection(params[:time_period]).where(:value.gt => 0).desc(:value).to_a
    end
  end

  def expires_in(time_period)
    case time_period
    when 'today'
      30.minutes
    else
      1.day
    end
  end

  def ranking_collection(time_period)
    "UserRanking#{time_period.classify}".constantize
  end
end
<commit_msg>Fix: typo<commit_after>class RankingsController < ApplicationController
  def index
    if %w(today this_week this_month all_time).include?(params[:time_period])
      @cache_expiration = expires_in(params[:time_period])
      @leaderboard = Kaminari.paginate_array(cached_leaderboard).page(params[:page])
    else
      not_found
    end
  end

  protected

  def cached_leaderboard
    Rails.cache.fetch([:user_ranking, params[:time_period]], :expires_in => @cache_expiration) do
      Tomato.ranking_collection(params[:time_period].to_sym)
      ranking_collection(params[:time_period]).where(:value.gt => 0).desc(:value).to_a
    end
  end

  def expires_in(time_period)
    case time_period
    when 'today'
      30.minutes
    else
      1.day
    end
  end

  def ranking_collection(time_period)
    "UserRanking#{time_period.classify}".constantize
  end
end

{'fraction_non_alphanumeric': 0.10057471264367816, 'fraction_numerical': 0.004597701149425287, 'mean_word_length': 4.061046511627907, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3089958', 'n_tokens_mistral': 582, 'n_tokens_neox': 555, 'n_words': 95}