<commit_before>class Activity < ActiveRecord::Base
  belongs_to :user
  belongs_to :goal

  def self.for_user(user)
    where(user: user)
  end

  def self.todays
    where(created_at: Time.now.beginning_of_day..Time.now.end_of_day)
  end

  def self.old
    created = Activity.arel_table[:created_at]
    where(created.lt(Time.now.beginning_of_day))
  end

  def self.active
    where(end: nil)
  end

  def active
    return self.end == nil
  end

end
<commit_msg>Make goal to activity relation optional.<commit_after>class Activity < ActiveRecord::Base
  belongs_to :user
  belongs_to :goal, optional: true

  def self.for_user(user)
    where(user: user)
  end

  def self.todays
    where(created_at: Time.now.beginning_of_day..Time.now.end_of_day)
  end

  def self.old
    created = Activity.arel_table[:created_at]
    where(created.lt(Time.now.beginning_of_day))
  end

  def self.active
    where(end: nil)
  end

  def active
    return self.end == nil
  end

end

{'fraction_non_alphanumeric': 0.09333333333333334, 'fraction_numerical': 0.0, 'mean_word_length': 3.376681614349776, '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': '5287093', 'n_tokens_mistral': 360, 'n_tokens_neox': 351, 'n_words': 77}