<commit_before>class UsersController < ApplicationController
  def show
    login = login_from_params

    @user = User.find_or_initialize_by_login(login)
    @user.new_record? and return redirect_to action: "create"

    @repos = Repo.find_all_by_owner(login)
  end

  def new
    login = login_from_params
    @user = User.find_or_initialize_by_login(login)

    @user.new_record? and return redirect_to action: "create"

    @repos = Repo.find_all_by_owner(login)

    @github_repos = github_list_repos_for_user(login)

  end

  def create
    login = login_from_params
    @user = User.find_or_initialize_by_login(login)
    
    if @user.new_record?
      @user.create_and_update_from_github
      flash[:notice] = "User #{ @user.login } successfully added."
      redirect_to action: "new"

    else
      flash[:notice] = "User #{ @user.login } already known."
      redirect_to action: "show"
      
    end


      # github.users.get(login)
      # github.repos.get(owner, name)
      # github.repos.list(user: login)

  end

protected
  <commit_msg>Redirection from user#create to user#show<commit_after>class UsersController < ApplicationController
  def show
    login = login_from_params

    @user = User.find_or_initialize_by_login(login)
    @user.new_record? and return redirect_to action: "create"

    @repos = Repo.find_all_by_owner(login)
  end

  def new
    login = login_from_params
    @user = User.find_or_initialize_by_login(login)

    @user.new_record? and return redirect_to action: "create"

    @repos = Repo.find_all_by_owner(login)

    @github_repos = github_list_repos_for_user(login)

  end

  def create
    login = login_from_params
    @user = User.find_or_initialize_by_login(login)
    
    if @user.new_record?
      @user.create_and_update_from_github
      flash[:notice] = "User #{ @user.login } successfully added."
      redirect_to action: "show"

    else
      flash[:notice] = "User #{ @user.login } already known."
      redirect_to action: "show"
      
    end


      # github.users.get(login)
      # github.repos.get(owner, name)
      # github.repos.list(user: login)

  end

protected
  
{'fraction_non_alphanumeric': 0.09408476944573824, 'fraction_numerical': 0.0, 'mean_word_length': 3.2534653465346532, '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': '1347173', 'n_tokens_mistral': 742, 'n_tokens_neox': 697, 'n_words': 142}