<commit_before>module SessionHelper

  def user
    @user ||= User.find(session[:user_id])
  end

  def logged_in?
    session[:user_id].present?
  end

  def visitor
    @visitor ||= User.find(session[:visitor_id])
  end

  def visiting?
    session[:visitor_id].present?
  end

  def flash_messages
    [:notice, :error].map do |type|
      if flash[type].present?
        haml "%li.#{type} #{flash[type]}"
      else
        ''
      end
    end.join
  end

end<commit_msg>Fixed problem when creating a new visitor session<commit_after>module SessionHelper

  def user
    @user ||= User.find(session[:user_id])
  end

  def logged_in?
    session[:user_id].present?
  end

  def visitor
    @visitor ||= User.find(session[:visitor_id]) unless session[:visitor_id].blank?
  end

  def visiting?
    session[:visitor_id].present?
  end

  def flash_messages
    [:notice, :error].map do |type|
      if flash[type].present?
        haml "%li.#{type} #{flash[type]}"
      else
        ''
      end
    end.join
  end

end
{'fraction_non_alphanumeric': 0.12609970674486803, 'fraction_numerical': 0.0, 'mean_word_length': 2.7785977859778597, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5190154', 'n_tokens_mistral': 354, 'n_tokens_neox': 343, 'n_words': 80}