<commit_before>class TrackedCard
  include Mongoid::Document
  include Mongoid::Timestamps
  extend MongoidHelper

  field :name
  field :description
  field :short_id,    type: Integer
  field :trello_id
  field :done,        type: Boolean
  field :due,         type: Date
  field :closed,      type: Boolean
  field :url
  field :pos

  embeds_many :estimates
  embeds_many :efforts

  validates_presence_of :name, :short_id, :trello_id
  validates_numericality_of :short_id

  def self.find_by_trello_id(trello_id)
    without_mongo_raising_errors do
      find_by(trello_id: trello_id)
    end
  end

  def self.update_or_create_with(trello_card)
    tracked_card = find_or_create_by(trello_id: trello_card.id)
    trello_card.attributes.delete(:id)
    tracked_card_attributes = trello_card.attributes.merge(done: trello_card.in_done_column?)
    updated_successfully = tracked_card.update_attributes(tracked_card_attributes)
    return tracked_card if updated_successfully
  end

  def self.all_tracked_cards(sorting_options = {})
    cards = all.reject(&:no_tracking?)

    cards = cards.sort_by(&sorting_options[:method].to_sym) if sorting_options[:method]

    sorting_options[:order] == :desc ? cards.reverse : cards<commit_msg>removing spaces<commit_after>class TrackedCard
  include Mongoid::Document
  include Mongoid::Timestamps
  extend MongoidHelper

  field :name
  field :description
  field :short_id,    type: Integer
  field :trello_id
  field :done,        type: Boolean
  field :due,         type: Date
  field :closed,      type: Boolean
  field :url
  field :pos

  embeds_many :estimates
  embeds_many :efforts

  validates_presence_of :name, :short_id, :trello_id
  validates_numericality_of :short_id

  def self.find_by_trello_id(trello_id)
    without_mongo_raising_errors do
      find_by(trello_id: trello_id)
    end
  end

  def self.update_or_create_with(trello_card)
    tracked_card = find_or_create_by(trello_id: trello_card.id)
    trello_card.attributes.delete(:id)
    tracked_card_attributes = trello_card.attributes.merge(done: trello_card.in_done_column?)
    updated_successfully = tracked_card.update_attributes(tracked_card_attributes)
    return tracked_card if updated_successfully
  end

  def self.all_tracked_cards(sorting_options = {})
    cards = all.reject(&:no_tracking?)
    cards = cards.sort_by(&sorting_options[:method].to_sym) if sorting_options[:method]
    sorting_options[:order] == :desc ? cards.reverse : cards
{'fraction_non_alphanumeric': 0.07835218093699516, 'fraction_numerical': 0.0, 'mean_word_length': 4.578828828828829, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3277900', 'n_tokens_mistral': 875, 'n_tokens_neox': 828, 'n_words': 160}