<commit_before># coding: utf-8
class DocumentsController < ApplicationController
  respond_to :odt, :only => :index
  respond_to :pdf, :only => :show
  respond_to :html, :xml, :json
  helper_method :sort_column, :sort_direction
  before_filter :get_document, :except => [:index, :print, :view]

  #autocomplete :user, :displayname

  def index
    if params[:directive_id].present? # документы относящиеся к директиве
      @directive = Directive.find(params[:directive_id])
      @documents = @directive.document.paginate(:per_page => 10, :page => params[:page])
    else
      if params[:all].present?
        @documents = Document.order(:part, :name).all
      else
        if params[:place].present?  # список документов по месту хранения
          @documents = Document.where(:place => params[:place]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 10, :page => params[:page])
        else
          if params[:dlevel].present? #  список документов уровня
            @documents = Document.where(:dlevel => params[:dlevel]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 10, :page => params[:page])
          else
            if params[:part].present? #  список документов раздела документооборота
              @documents = Document.where(:part => params[:part]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 10, :page => params[:page])
            else
              if params[:status].present? #  список документов статуса
                ss = params[:status]
                @documents = Document.where(:status => ss).order(sort_column + ' ' + sort_direction).paginate(:per_page => 10, :page => params[:page])
              else<commit_msg>fix: правильная сортировка документов по полю part<commit_after># coding: utf-8
class DocumentsController < ApplicationController
  respond_to :odt, :only => :index
  respond_to :pdf, :only => :show
  respond_to :html, :xml, :json
  helper_method :sort_column, :sort_direction
  before_filter :get_document, :except => [:index, :print, :view]

  #autocomplete :user, :displayname

  def index
    if params[:directive_id].present? # документы относящиеся к директиве
      @directive = Directive.find(params[:directive_id])
      @documents = @directive.document.paginate(:per_page => 10, :page => params[:page])
    else
      if params[:all].present?
        @documents = Document.order('cast (part as integer)', :name).all
      else
        if params[:place].present?  # список документов по месту хранения
          @documents = Document.where(:place => params[:place]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 10, :page => params[:page])
        else
          if params[:dlevel].present? #  список документов уровня
            @documents = Document.where(:dlevel => params[:dlevel]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 10, :page => params[:page])
          else
            if params[:part].present? #  список документов раздела документооборота
              @documents = Document.where(:part => params[:part]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 10, :page => params[:page])
            else
              if params[:status].present? #  список документов статуса
                ss = params[:status]
                @documents = Document.where(:status => ss).order(sort_column + ' ' + sort_direction).paginate(:per_page => 10, :page => params[:page])
              else
{'fraction_non_alphanumeric': 0.1382301908617698, 'fraction_numerical': 0.006362058993637941, 'mean_word_length': 3.32375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4654898', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1060, 'n_words': 226}