<commit_before>class Participant < ActiveRecord::Base
  belongs_to :event
  belongs_to :user
  
  validates_uniqueness_of :user_id,
                          :scope => [ :event_id]
                        
  validates_uniqueness_of :email,
                          :scope => [ :event_id]
end<commit_msg>callback that procces an event_invitation when a participant confirm his attendance directly without using the invitation<commit_after>class Participant < ActiveRecord::Base
  belongs_to :event
  belongs_to :user
  
  validates_uniqueness_of :user_id,
                          :scope => [ :event_id]
                        
  validates_uniqueness_of :email,
                          :scope => [ :event_id]
                          
  after_create do |participant|
    invitation = participant.event.event_invitations.select{|e| e.candidate == participant.user or e.email == participant.user.email}.first
    if !invitation.processed?
      invitation.processed_at = Time.now
      participant.attend? ? invitation.accepted = true : invitation.accepted = false
      invitation.save
    end
  end
end
{'fraction_non_alphanumeric': 0.07497741644083107, 'fraction_numerical': 0.0, 'mean_word_length': 2.2684365781710913, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3068262', 'n_tokens_mistral': 305, 'n_tokens_neox': 306, 'n_words': 68}