<commit_before>class Request < ActiveRecord::Base
  before_create :defaultly_unfulfilled

  has_many :messages
  has_many :transactions

  belongs_to :requester, class_name: 'User'
  belongs_to :responder, class_name: 'User'
  belongs_to :group

  validates :content, :requester, :group, presence: true
  validates :is_fulfilled, inclusion: { in: [true, false] }

  def active?
    # placeholder, must put logic here
    true
  end

  private

  def defaultly_unfulfilled
    self.is_fulfilled = false
    true
  end
end
<commit_msg>Add method is_party_to? that returns a boolean if the user passed in is a party to that request.<commit_after>class Request < ActiveRecord::Base
  before_create :defaultly_unfulfilled

  has_many :messages
  has_many :transactions

  belongs_to :requester, class_name: 'User'
  belongs_to :responder, class_name: 'User'
  belongs_to :group

  validates :content, :requester, :group, presence: true
  validates :is_fulfilled, inclusion: { in: [true, false] }

  def active?
    # placeholder, must put logic here
    true
  end

  def is_party_to?(user)
    [requester.id, responder.id].include?(user.id)
  end

  private

  def defaultly_unfulfilled
    self.is_fulfilled = false
    true
  end
end

{'fraction_non_alphanumeric': 0.07873376623376624, 'fraction_numerical': 0.0, 'mean_word_length': 4.1161825726141075, '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': '1639681', 'n_tokens_mistral': 409, 'n_tokens_neox': 403, 'n_words': 118}