<commit_before>class ProjectStatus < ActiveRecord::Base
  SUCCESS = 'success'
  FAILURE = 'failure'

  belongs_to :project

  validates :success, inclusion: { in: [true, false] }
  validates :build_id, presence: true

  def self.recent(projects, limit)
    where(project_id: Array(projects).map(&:id)).
      where('build_id IS NOT NULL').
      reverse_chronological.
      limit(limit)
  end

  def self.reverse_chronological
    order('build_id DESC')
  end

  def self.latest
    reverse_chronological.first
  end

  def self.green
    where(success: true)
  end

  def self.red
    where(success: false)
  end
<commit_msg>ProjectStatus.reverse_chronological ignores those with nil build ids<commit_after>class ProjectStatus < ActiveRecord::Base
  SUCCESS = 'success'
  FAILURE = 'failure'

  belongs_to :project

  validates :success, inclusion: { in: [true, false] }
  validates :build_id, presence: true

  def self.recent(projects, limit)
    where(project_id: Array(projects).map(&:id)).
      reverse_chronological.
      limit(limit)
  end

  def self.reverse_chronological
    where('build_id IS NOT NULL').
      order('build_id DESC')
  end

  def self.latest
    reverse_chronological.first
  end

  def self.green
    where(success: true)
  end

  def self.red
    where(success: false)
  end

{'fraction_non_alphanumeric': 0.09702062643239114, 'fraction_numerical': 0.0, 'mean_word_length': 3.548611111111111, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3488492', 'n_tokens_mistral': 428, 'n_tokens_neox': 408, 'n_words': 106}