<commit_before>class Tournaments::GamesController < ApplicationController
  before_filter :find_tournament_and_games
  before_filter :require_owner!

  layout 'tournament_title', :only => [:index]

  def index
    @pending_invite_requests = @tournament.invite_requests.where(invite_id: nil)
  end

  def destroy
    @games.find(params[:id]).destroy
    redirect_to tournament_games_path(@tournament)
  end

  private

  def find_tournament_and_games
    @tournament = Tournament.friendly.find(params[:tournament_id])
    @games = @tournament.games.challenged_or_unconfirmed.readonly(false)
  end

  def require_owner!
    unless current_user.id == @tournament.owner_id
      redirect_to tournament_path(@tournament)
    end
  end
end<commit_msg>Order games in admin by creation date<commit_after>class Tournaments::GamesController < ApplicationController
  before_filter :find_tournament_and_games
  before_filter :require_owner!

  layout 'tournament_title', :only => [:index]

  def index
    @pending_invite_requests = @tournament.invite_requests.where(invite_id: nil)
  end

  def destroy
    @games.find(params[:id]).destroy
    redirect_to tournament_games_path(@tournament)
  end

  private

  def find_tournament_and_games
    @tournament = Tournament.friendly.find(params[:tournament_id])
    @games = @tournament.games.challenged_or_unconfirmed.order('games.created_at DESC').readonly(false)
  end

  def require_owner!
    unless current_user.id == @tournament.owner_id
      redirect_to tournament_path(@tournament)
    end
  end
end
{'fraction_non_alphanumeric': 0.0854368932038835, 'fraction_numerical': 0.0, 'mean_word_length': 5.134920634920635, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '970385', 'n_tokens_mistral': 528, 'n_tokens_neox': 472, 'n_words': 88}