<commit_before>require './config/environment'
require 'rack-flash'

class ApplicationController < Sinatra::Base

  configure do
    set :public_folder, 'public'
    set :views, 'app/views'
    enable :sessions
    set :session_secret, "curveball"
  end
  use Rack::Flash

  get '/' do 
    erb :index
  end

  helpers do
    def logged_in?
      !!session[:user_id]
    end

    def current_user
      Coach.find(session[:user_id])
    end
  end

end<commit_msg>conditionally set @current_user<commit_after>require './config/environment'
require 'rack-flash'

class ApplicationController < Sinatra::Base

  configure do
    set :public_folder, 'public'
    set :views, 'app/views'
    enable :sessions
    set :session_secret, "curveball"
  end
  use Rack::Flash

  get '/' do 
    erb :index
  end

  helpers do
    def logged_in?
      !!session[:user_id]
    end

    def current_user
      @current_user ||= Coach.find(session[:user_id]) if logged_in?
    end
  end

end
{'fraction_non_alphanumeric': 0.10061601642710473, 'fraction_numerical': 0.0, 'mean_word_length': 3.045643153526971, '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': '4542201', 'n_tokens_mistral': 336, 'n_tokens_neox': 320, 'n_words': 84}