<commit_before>class DashboardController < ApplicationController
  before_action :authenticate_user!, PQUserFilter

  # this filters reflect the state of the 'New' or 'In Progress' tab
  before_action :set_state_to_new, only: [:index, :by_status, :transferred]
  before_action :set_state_to_in_progress, only: [:in_progress, :in_progress_by_status, :i_will_write]

  IN_PROGRESS = 'In progress'
  NEW = 'New'

  # TODO define the number of question per page
  @@per_page = 5


  def index
    @questions = PQ.new_questions.paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load

    # FIXME this is just testing that statsd works
    # counter of times that the dashboard is hit
    $statsd.increment 'dashboard.hits'
  end

  def in_progress
    @questions = PQ.in_progress.paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
  end

  def search
  end

  def by_status
    @questions = PQ.by_status(params[:qstatus]).paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
  end

  def in_progress_by_status
    by_status
  end

  def transferred
    @questions = PQ.transferred.paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
    render 'by_status'
  end

  def i_will_write
    @questions = PQ.i_will_write_flag.paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
    render 'in_progress_by_status'
  end


  private

  def set_state_to_in_progress<commit_msg>clean up old code<commit_after>class DashboardController < ApplicationController
  before_action :authenticate_user!, PQUserFilter

  # this filters reflect the state of the 'New' or 'In Progress' tab
  before_action :set_state_to_new, only: [:index, :by_status, :transferred]
  before_action :set_state_to_in_progress, only: [:in_progress, :in_progress_by_status, :i_will_write]

  IN_PROGRESS = 'In progress'
  NEW = 'New'

  # TODO define the number of question per page
  @@per_page = 5


  def index
    @questions = PQ.new_questions.paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
  end

  def in_progress
    @questions = PQ.in_progress.paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
  end

  def search
  end

  def by_status
    @questions = PQ.by_status(params[:qstatus]).paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
  end

  def in_progress_by_status
    by_status
  end

  def transferred
    @questions = PQ.transferred.paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
    render 'by_status'
  end

  def i_will_write
    @questions = PQ.i_will_write_flag.paginate(:page => params[:page], :per_page => @@per_page).order(:internal_deadline).load
    render 'in_progress_by_status'
  end


  private

  def set_state_to_in_progress
{'fraction_non_alphanumeric': 0.11475964793500339, 'fraction_numerical': 0.0006770480704129993, 'mean_word_length': 4.851485148514851, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '2750966', 'n_tokens_mistral': 1025, 'n_tokens_neox': 966, 'n_words': 218}