<commit_before>class SummonersController < ApplicationController
  before_action :set_summoner, only: :show

  def index
    @summoners = Summoner.all
  end

  def show
    #matches = @summoner.matches.paginate(page: params[:page], per_page: 10)
    matches = Match.with_opponent.where(summoner: @summoner).order(match_creation: :desc)
    matches = matches.where(champion: params[:champion].titleize) if params.has_key? :champion
    @matches = matches.paginate(page: params[:page], per_page: 10)
  end

  private

  def set_summoner
    @summoner = Summoner.find(params[:id])
  end<commit_msg>Add more filter params (still hidden)<commit_after>class SummonersController < ApplicationController
  before_action :set_summoner, only: :show

  def index
    @summoners = Summoner.all
  end

  def show
    #matches = @summoner.matches.paginate(page: params[:page], per_page: 10)
    matches = Match.with_opponent.where(summoner: @summoner).order(match_creation: :desc)
    @matches = filter_by_params(matches).paginate(page: params[:page], per_page: 10)
  end

  private

  def set_summoner
    @summoner = Summoner.find(params[:id])
  end

  def filter_by_params(matches)
    matches = matches.where(champion: params[:champion].titleize) if params.has_key? :champion
    matches = matches.where(opponent_champion: params[:opponent].titleize) if params.has_key? :opponent
    matches = matches.where(lane: params[:lane].upcase) if params.has_key? :lane
    queue_params = {
      'flex' => "RANKED_FLEX_SR",
      'solo' => "TEAM_BUILDER_RANKED_SOLO",
      'fives' =>"TEAM_BUILDER_DRAFT_RANKED_5x5"
    }
    matches = matches.where(queue: queue_params[params[:queue]]) if params.has_key? :queue
    matches
  end
{'fraction_non_alphanumeric': 0.11682242990654206, 'fraction_numerical': 0.005841121495327103, 'mean_word_length': 4.672185430463577, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '7377084', 'n_tokens_mistral': 606, 'n_tokens_neox': 592, 'n_words': 115}