<commit_before>class User < ActiveRecord::Base
  has_secure_password

  has_many :event_wines
  has_many :events
  has_many :tastings

  validates :email,     presence: true,
                        format: { :with => /\w+@\w+\.\w+/}
  validates :name,      presence: true

  validates :password,  length: { minimum: 3 },
                        confirmation: true,
                        presence: true

  def upcoming_events
    self.events.where(['date >= ?', Time.now])
  end

  def past_events
    self.events.where(['date < ?', Time.now])
  end

end<commit_msg>Refactor upcoming and past events methods Lets check with Jessica to make sure this isn't duplicative of the attending_users method on the event model<commit_after>class User < ActiveRecord::Base
  has_secure_password

  has_many :event_wines
  has_many :events
  has_many :tastings

  validates :email,     presence: true,
                        format: { :with => /\w+@\w+\.\w+/}
  validates :name,      presence: true

  validates :password,  length: { minimum: 3 },
                        confirmation: true,
                        presence: true

  def upcoming_events
    self.event_wines.where(event: Event.where(['date >= ?', Time.now]))
  end

  def past_events
    self.event_wines.where(event: Event.where(['date < ?', Time.now]))
  end

end
{'fraction_non_alphanumeric': 0.10959939531368103, 'fraction_numerical': 0.0015117157974300832, 'mean_word_length': 2.4123711340206184, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1632144', 'n_tokens_mistral': 410, 'n_tokens_neox': 391, 'n_words': 106}