<commit_before>class HabitsController < ApplicationController
  before_action :set_habit, only: [:show, :edit, :update, :destroy]
  # doorkeeper_for :all, if: lambda { request.headers["Content-Type"] == "application/json" }
  # before_filter :authenticate_user!, unless: lambda { request.headers["Content-Type"] == "application/json" }
  skip_before_action :verify_authenticity_token, if: lambda { request.format.json? }

  # GET /habits
  # GET /habits.json
  def index
    if params[:created_since]
      @habits = current_user.habits.where("created_at >= ?", Time.at(params[:created_since].to_i))
    elsif params[:updated_since]
      update_time = Time.at(params[:updated_since].to_i)
      @habits = current_user.habits.where("created_at < ? AND updated_at >= ?", update_time, update_time)
    else
      @habits = current_user.habits
    end<commit_msg>verifying current user is nil<commit_after>class HabitsController < ApplicationController
  before_action :set_habit, only: [:show, :edit, :update, :destroy]
  # doorkeeper_for :all, if: lambda { request.headers["Content-Type"] == "application/json" }
  # before_filter :authenticate_user!, unless: lambda { request.headers["Content-Type"] == "application/json" }
  skip_before_action :verify_authenticity_token, if: lambda { request.format.json? }

  # GET /habits
  # GET /habits.json
  def index
    puts "Current User: " + (current_user ? current_user.email : 'nil')
    if params[:created_since]
      @habits = current_user.habits.where("created_at >= ?", Time.at(params[:created_since].to_i))
    elsif params[:updated_since]
      update_time = Time.at(params[:updated_since].to_i)
      @habits = current_user.habits.where("created_at < ? AND updated_at >= ?", update_time, update_time)
    else
      @habits = current_user.habits
    end
{'fraction_non_alphanumeric': 0.13329646017699115, 'fraction_numerical': 0.0, 'mean_word_length': 4.688679245283019, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2998151', 'n_tokens_mistral': 585, 'n_tokens_neox': 577, 'n_words': 113}