<commit_before>class Video < ActiveRecord::Base
  enum debate_type: [:policy, :parli, :lincoln_douglass]
  enum debate_level: [:hs, :college]
  enum provider: [:youtube, :vimeo]

  def self.debate_levels_select
    { 'HS' => 'hs', 'College' => 'college' }
  end

  def self.debate_types_select
    { 'Policy' => 'policy', 'Parli' => 'parli', 'LD' => 'ld' }
  end

  belongs_to :user
  belongs_to :tournament

  belongs_to :aff_team, class_name: 'Team', foreign_key: :aff_team_id
  belongs_to :neg_team, class_name: 'Team', foreign_key: :neg_team_id

  has_and_belongs_to_many :tags

  serialize :key, Array

  attr_accessor :year, :aff_school, :neg_school, :aff_debater_one, :aff_debater_two, :neg_debater_one, :neg_debater_two, :tags_ids

  def title
    "#{tournament.year_and_name}: #{aff_team.code} vs. #{neg_team.code}"
  end

  def thumbnail
    if youtube?
      read_attribute(:thumbnail).sub('/default', '/hqdefault')
    else
      read_attribute(:thumbnail).sub('200x150', '600x450')
    end
  end

  def team_one
    teams.first
  end

  def team_two
    teams.last
  end

  def to_s
    title
  end
end<commit_msg>Handle nil thumbnail<commit_after>class Video < ActiveRecord::Base
  enum debate_type: [:policy, :parli, :lincoln_douglass]
  enum debate_level: [:hs, :college]
  enum provider: [:youtube, :vimeo]

  def self.debate_levels_select
    { 'HS' => 'hs', 'College' => 'college' }
  end

  def self.debate_types_select
    { 'Policy' => 'policy', 'Parli' => 'parli', 'LD' => 'ld' }
  end

  belongs_to :user
  belongs_to :tournament

  belongs_to :aff_team, class_name: 'Team', foreign_key: :aff_team_id
  belongs_to :neg_team, class_name: 'Team', foreign_key: :neg_team_id

  has_and_belongs_to_many :tags

  serialize :key, Array

  attr_accessor :year, :aff_school, :neg_school, :aff_debater_one, :aff_debater_two, :neg_debater_one, :neg_debater_two, :tags_ids

  def title
    "#{tournament.year_and_name}: #{aff_team.code} vs. #{neg_team.code}"
  end

  def thumbnail
    return nil unless read_attribute(:thumbnail)
    if youtube?
      read_attribute(:thumbnail).sub('/default', '/hqdefault')
    else
      read_attribute(:thumbnail).sub('200x150', '600x450')
    end
  end

  def team_one
    teams.first
  end

  def team_two
    teams.last
  end

  def to_s
    title
  end
end
{'fraction_non_alphanumeric': 0.12597402597402596, 'fraction_numerical': 0.01038961038961039, 'mean_word_length': 4.079120879120879, 'pattern_counts': {'":': 0, '<': 5, '<?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': '307955', 'n_tokens_mistral': 924, 'n_tokens_neox': 871, 'n_words': 191}