<commit_before>namespace :get_games do
  desc 'Get all the games from Riot API'
  task matches: :environment do
    client = RiotLolApi::Client.new do |config|
      config.region = 'na'
      config.api_key = ENV['RIOT_API_KEY']
    end

    Summoner.all.each do |summoner|
      summoner.get_new_match_ids.each do |match_id|
        sleep(1.0)
        match = client.match(match_id)
        i = 0
        while i <= 10 && match.nil?
          puts "Retry #{i} of 10"
          sleep(i)
          i += 1
          match = client.match(match_id)
        end
        participant_id = match.participant_identities.find { |p| p.player.summoner_name == summoner.name }.participant_id
        participant = match.participants.find { |p| p.participant_id == participant_id }
        opponent = match.participants.find { |p| p.team_id != participant && p.timeline.lane == participant.timeline.lane }

        duration = match.match_duration/60.0<commit_msg>Add summoner name to query retries<commit_after>namespace :get_games do
  desc 'Get all the games from Riot API'
  task matches: :environment do
    client = RiotLolApi::Client.new do |config|
      config.region = 'na'
      config.api_key = ENV['RIOT_API_KEY']
    end

    Summoner.all.each do |summoner|
      summoner.get_new_match_ids.each do |match_id|
        sleep(1.0)
        match = client.match(match_id)
        i = 0
        while i <= 10 && match.nil?
          puts "Retry #{i} of 10 for #{summoner.name}"
          sleep(i)
          i += 1
          match = client.match(match_id)
        end
        participant_id = match.participant_identities.find { |p| p.player.summoner_name == summoner.name }.participant_id
        participant = match.participants.find { |p| p.participant_id == participant_id }
        opponent = match.participants.find { |p| p.team_id != participant && p.timeline.lane == participant.timeline.lane }

        duration = match.match_duration/60.0
{'fraction_non_alphanumeric': 0.10916580844490216, 'fraction_numerical': 0.01132852729145211, 'mean_word_length': 2.5391621129326047, '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': '738422', 'n_tokens_mistral': 651, 'n_tokens_neox': 632, 'n_words': 146}