<commit_before>class RelatedTasksController < ApplicationController
  inject :related_task_manager
  inject :related_task_searcher
  inject :time_entry_searcher

  load_and_authorize_resource except: [:create, :update]

  before_filter :prepare_gon, only: [:new, :edit]

  def index
    @search = RelatedTaskSearchForm.new(params[:search])
    @search.from ||= session[:search_from]
    @search.to ||= session[:search_to]
    @search.projects ||= session[:search_projects]
    @search.developers ||= session[:search_developers]
    @projects = current_user.projects.map{ |p| [p.name, p.id] }
    @time_entries = time_entry_searcher.find_by_form(@search).includes(:related_task).order(date: :DESC)
    session[:search_from] = @search.from
    session[:search_to] = @search.to
    session[:search_projects] = @search.projects
    session[:search_developers] = @search.developers
    @sum = @time_entries.to_a.inject(0) { |sum, task| sum + task.duration }
    @time_entries = @time_entries.paginate(page: params[:page], per_page: 20)<commit_msg>search in one key in session<commit_after>class RelatedTasksController < ApplicationController
  inject :related_task_manager
  inject :related_task_searcher
  inject :time_entry_searcher

  load_and_authorize_resource except: [:create, :update]

  before_filter :prepare_gon, only: [:new, :edit]

  def index
    search = session[:search_rt] ? session[:search_rt].merge(params[:search] || {}) : params[:search]
    @search = RelatedTaskSearchForm.new(search)
    session[:search_rt] = search
    @projects = current_user.projects.map{ |p| [p.name, p.id] }
    @time_entries = time_entry_searcher.find_by_form(@search).includes(:related_task).order(date: :DESC)
    @sum = @time_entries.to_a.inject(0) { |sum, task| sum + task.duration }
    @time_entries = @time_entries.paginate(page: params[:page], per_page: 20)
{'fraction_non_alphanumeric': 0.13193322563274099, 'fraction_numerical': 0.0032310177705977385, 'mean_word_length': 5.519298245614035, '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': '4881397', 'n_tokens_mistral': 606, 'n_tokens_neox': 601, 'n_words': 108}