<commit_before>class Dataset < ActiveRecord::Base

  mount_uploader :logo, ImageUploader

  # Concerns
  include Deletable

  # Model Validation
  validates_presence_of :name, :slug, :user_id
  validates_uniqueness_of :slug, scope: [ :deleted ]
  validates_format_of :slug, with: /\A[a-z]\w*\Z/i

  # Model Relationships
  belongs_to :user

  def to_param
    slug
  end

  def self.find_by_param(input)
    find_by_slug(input)
  end

  def files
    Dir.glob("carrierwave/datasets/files/#{self.id}/*").collect{|f| [f.split('/').last, f]}
  end

  def editable_by?(current_user)
    @editable_by ||= begin
      current_user.all_datasets.where(id: self.id).count == 1
    end
  end

end
<commit_msg>Sort files by name<commit_after>class Dataset < ActiveRecord::Base

  mount_uploader :logo, ImageUploader

  # Concerns
  include Deletable

  # Model Validation
  validates_presence_of :name, :slug, :user_id
  validates_uniqueness_of :slug, scope: [ :deleted ]
  validates_format_of :slug, with: /\A[a-z]\w*\Z/i

  # Model Relationships
  belongs_to :user

  def to_param
    slug
  end

  def self.find_by_param(input)
    find_by_slug(input)
  end

  def files
    Dir.glob("carrierwave/datasets/files/#{self.id}/*").collect{|f| [f.split('/').last, f]}.sort{|a,b| a[0] <=> b[0]}
  end

  def editable_by?(current_user)
    @editable_by ||= begin
      current_user.all_datasets.where(id: self.id).count == 1
    end
  end

end

{'fraction_non_alphanumeric': 0.12806158152554234, 'fraction_numerical': 0.0027991602519244225, 'mean_word_length': 3.673202614379085, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '3670422', 'n_tokens_mistral': 564, 'n_tokens_neox': 546, 'n_words': 107}