<commit_before>class TeamsController < ApplicationController
  get '/teams' do 
      @teams = Team.all
      erb :'/teams/index'
  end

  get '/teams/:id/build' do 
    @team = Team.find(params[:id])    
    if !logged_in?
      redirect '/login'
    elsif @team.id != current_user.team_id || !current_user.players.empty?
      redirect '/teams'
    else
      erb :'/teams/build_roster'
    end
  end

  post '/teams/:id/build' do  
    if params["player"].detect {|player| player.values.include?("")}
      redirect "/teams/#{current_user.team_id}/build"
    else
      params[:player].each do |player| 
         new_player = Player.create(player)
         new_player.team_id = current_user.team_id
         new_player.save
      end
    end
    
    redirect "/teams/#{current_user.team_id}"
  end

  get '/teams/:id' do
    @team = Team.find(params[:id]) 
    erb :'/teams/team_show'<commit_msg>removed @teams from get build route, using current_user instead<commit_after>class TeamsController < ApplicationController
  get '/teams' do 
      @teams = Team.all
      erb :'/teams/index'
  end

  get '/teams/:id/build' do   
    if !logged_in?
      redirect '/login'
    elsif params[:id] != current_user.team_id || !current_user.players.empty?
      redirect '/teams'
    else
      erb :'/teams/build_roster'
    end
  end

  post '/teams/:id/build' do  
    if params["player"].detect {|player| player.values.include?("")}
      redirect "/teams/#{current_user.team_id}/build"
    else
      params[:player].each do |player| 
         new_player = Player.create(player)
         new_player.team_id = current_user.team_id
         new_player.save
      end
    end
    
    redirect "/teams/#{current_user.team_id}"
  end

  get '/teams/:id' do
    @team = Team.find(params[:id]) 
    erb :'/teams/team_show'
{'fraction_non_alphanumeric': 0.13381057268722468, 'fraction_numerical': 0.0, 'mean_word_length': 2.535019455252918, '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': '2345766', 'n_tokens_mistral': 638, 'n_tokens_neox': 623, 'n_words': 127}