<commit_before>class Event < ApplicationRecord
  validates_presence_of :slug
  validates_uniqueness_of :slug

  def format
    Format["custom standard"].new
  end

  def official?
    self.organizer.nil?
  end

  def organizer
    nil #TODO
  end

  def rel_pretty
    case self.rel
    when "reg"
      "Regular"
    when "comp"
      "Competitive"
    when "prof"
      "Professional"
    else
      self.rel
    end
  end

  def signups
    EventSignup.where(event_slug: self.slug)
  end

  def state
    if self.end <= DateTime.current
      :ended
    elsif self.start <= DateTime.current
      :bracket
    elsif self.sideboard_submissions <= DateTime.current
      :sideboards
    elsif self.mainboard_submissions <= DateTime.current
      :mainboards
    elsif self.announcement <= DateTime.current
      :announced<commit_msg>Add missing nil checks to Event.state<commit_after>class Event < ApplicationRecord
  validates_presence_of :slug
  validates_uniqueness_of :slug

  def format
    Format["custom standard"].new
  end

  def official?
    self.organizer.nil?
  end

  def organizer
    nil #TODO
  end

  def rel_pretty
    case self.rel
    when "reg"
      "Regular"
    when "comp"
      "Competitive"
    when "prof"
      "Professional"
    else
      self.rel
    end
  end

  def signups
    EventSignup.where(event_slug: self.slug)
  end

  def state
    if self.end.present? && self.end <= DateTime.current
      :ended
    elsif self.start.present? && self.start <= DateTime.current
      :bracket
    elsif self.sideboard_submissions.present? && self.sideboard_submissions <= DateTime.current
      :sideboards
    elsif self.mainboard_submissions.present? && self.mainboard_submissions <= DateTime.current
      :mainboards
    elsif self.announcement.present? && self.announcement <= DateTime.current
      :announced
{'fraction_non_alphanumeric': 0.0790899241603467, 'fraction_numerical': 0.0, 'mean_word_length': 2.746450304259635, 'pattern_counts': {'":': 0, '<': 15, '<?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': '2106577', 'n_tokens_mistral': 599, 'n_tokens_neox': 572, 'n_words': 139}