<commit_before>class TimersController < ApplicationController
  before_action :set_active_nav

  def index
    authorize! :index, Timer
    @date = date
    projects = current_user.projects
    @projects = projects.all
  end

  def new_import
    authorize! :new_import, Timer
  end

  def csv_import
    authorize! :csv_import, Timer
    if Timer.import(params[:timer][:file], params[:timer][:project_id])
      redirect_to timers_path, notice: I18n.t(:"messages.timer.import.success")
    else
      redirect_to timers_path, alert: I18n.t(:"messages.timer.import.failure")
    end
  end

  private

  def set_active_nav
    @active_nav = 'timers'
  end

  def week
    @week ||= current_user.weeks.where(start_date: date.beginning_of_week).first
    @week ||= current_user.weeks.new
  end
  helper_method :week

  def date
    @date ||= (params[:date].present? ? Date.parse(params.fetch(:date, nil)) : Date.today)
  end
end
<commit_msg>sort projects in task modal by created_at<commit_after>class TimersController < ApplicationController
  before_action :set_active_nav

  def index
    authorize! :index, Timer
    @date = date
    projects = current_user.projects.order("created_at DESC")
    @projects = projects.all
  end

  def new_import
    authorize! :new_import, Timer
  end

  def csv_import
    authorize! :csv_import, Timer
    if Timer.import(params[:timer][:file], params[:timer][:project_id])
      redirect_to timers_path, notice: I18n.t(:"messages.timer.import.success")
    else
      redirect_to timers_path, alert: I18n.t(:"messages.timer.import.failure")
    end
  end

  private

  def set_active_nav
    @active_nav = 'timers'
  end

  def week
    @week ||= current_user.weeks.where(start_date: date.beginning_of_week).first
    @week ||= current_user.weeks.new
  end
  helper_method :week

  def date
    @date ||= (params[:date].present? ? Date.parse(params.fetch(:date, nil)) : Date.today)
  end
end

{'fraction_non_alphanumeric': 0.10938310005184033, 'fraction_numerical': 0.00414722654224987, 'mean_word_length': 3.742014742014742, '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': '1867235', 'n_tokens_mistral': 670, 'n_tokens_neox': 635, 'n_words': 141}