<commit_before>class TraspasosDatatable
  delegate :params, :link_to, :h, to: :@view

  def initialize(view)
    @view = view
  end

  def as_json(options = {})
    {
      sEcho: params[:sEcho].to_i,
      iTotalRecords: Traspaso.count,
      iTotalDisplayRecords: traspasos.total_entries,
      aaData: data
    }
  end

private

  def data
    traspasos.map do |traspaso|
      [
        (traspaso.numero),
        (traspaso.servicio),
        (traspaso.user.username),
        (traspaso.entregado_a),
        (traspaso.fecha_emision),
        # (traspaso.subtotal),
        # (traspaso.iva),
        # (traspaso.total),
        (link_to '', traspaso, :remote => true, :rel=> 'tooltip', :title=>'Mostrar','data-toggle' =>  "modal", 'data-target' => '#myModal', class: "ttip mostrar fa fa-eye btn btn-info")
      ]
    end 
  end

  def traspasos
    @traspasos ||= fetch_traspasos
  end

  def fetch_traspasos
    traspasos = Traspaso.order("#{sort_column} #{sort_direction}")
    traspasos = traspasos.page(page).per_page(per_page)
    if params[:sSearch].present?
      traspasos = traspasos.where("numero like :search or servicio like :search", search: "%#{params[:sSearch]}%")
    end
    traspasos
  end

  def page
    params[:iDisplayStart].to_i/per_page + 1
  end
<commit_msg>removed comments<commit_after>class TraspasosDatatable
  delegate :params, :link_to, :h, to: :@view

  def initialize(view)
    @view = view
  end

  def as_json(options = {})
    {
      sEcho: params[:sEcho].to_i,
      iTotalRecords: Traspaso.count,
      iTotalDisplayRecords: traspasos.total_entries,
      aaData: data
    }
  end

private

  def data
    traspasos.map do |traspaso|
      [
        (traspaso.numero),
        (traspaso.servicio),
        (traspaso.user.username),
        (traspaso.entregado_a),
        (traspaso.fecha_emision),
        (link_to '', traspaso, :remote => true, :rel=> 'tooltip', :title=>'Mostrar','data-toggle' =>  "modal", 'data-target' => '#myModal', class: "ttip mostrar fa fa-eye btn btn-info")
      ]
    end 
  end

  def traspasos
    @traspasos ||= fetch_traspasos
  end

  def fetch_traspasos
    traspasos = Traspaso.order("#{sort_column} #{sort_direction}")
    traspasos = traspasos.page(page).per_page(per_page)
    if params[:sSearch].present?
      traspasos = traspasos.where("numero like :search or servicio like :search", search: "%#{params[:sSearch]}%")
    end
    traspasos
  end

  def page
    params[:iDisplayStart].to_i/per_page + 1
  end

{'fraction_non_alphanumeric': 0.1343223736968725, 'fraction_numerical': 0.0008019246190858059, 'mean_word_length': 2.9792663476874, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6185258', 'n_tokens_mistral': 950, 'n_tokens_neox': 936, 'n_words': 176}