<commit_before>class Track < ActiveRecord::Base
  has_many :track_points, dependent: :destroy, autosave: true
  has_many :starts, dependent: :destroy, autosave: true
  has_many :ends, dependent: :destroy, autosave: true
  has_many :start_times, dependent: :destroy, autosave: true

  after_initialize :init

  accepts_nested_attributes_for :start_times
  accepts_nested_attributes_for :starts
  accepts_nested_attributes_for :ends

  validates :name, presence: true

  def init
    self.color_index ||= rand * Track.colors.size
  end

  def points_list
    track_points.map {|p| [p.latitude, p.longitude] }
  end

  def start
    starts.order(:time).first
  end

  def color
    init if color_index.nil?
    Track.colors[color_index % Track.colors.size]
  end

  def self.colors
    ['red', '#D91E18', '#96281B', '#2574A9', '#1E824C', '#F89406', '#6C7A89',
      '#22313F', '#2ECC71']<commit_msg>Remove init<commit_after>class Track < ActiveRecord::Base
  has_many :track_points, dependent: :destroy, autosave: true
  has_many :starts, dependent: :destroy, autosave: true
  has_many :ends, dependent: :destroy, autosave: true
  has_many :start_times, dependent: :destroy, autosave: true

  after_initialize :init

  accepts_nested_attributes_for :start_times
  accepts_nested_attributes_for :starts
  accepts_nested_attributes_for :ends

  validates :name, presence: true

  def init
    self.color_index ||= rand * Track.colors.size
  end

  def points_list
    track_points.map {|p| [p.latitude, p.longitude] }
  end

  def start
    starts.order(:time).first
  end

  def color
    Track.colors[color_index % Track.colors.size]
  end

  def self.colors
    ['red', '#D91E18', '#96281B', '#2574A9', '#1E824C', '#F89406', '#6C7A89',
      '#22313F', '#2ECC71']
{'fraction_non_alphanumeric': 0.11697898921067575, 'fraction_numerical': 0.039750141964792735, 'mean_word_length': 4.404907975460123, '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': '6157488', 'n_tokens_mistral': 658, 'n_tokens_neox': 619, 'n_words': 147}