<commit_before># Model to keep track of tag-node joins

class TaggedNode < ActiveRecord::Base
  attr_accessible :comment, :node_id, :tag_id, :person_id

  belongs_to :node
  belongs_to :tag
  belongs_to :person

  validates :node_id, :presence => true
  validates :tag_id, :presence => true
  validates :person_id, :presence => true

  validates :tag_id, :uniqueness => { :scope => [:node_id, :person_id] }

  scope :created_since, lambda { |since| { :conditions => ['created_at >= ? ', since] }}

  after_save :notify_people
  after_save :tweet_tagged_node

  def new_thing
    {:id => id,
      :node_id => node_id,
      :node_name => node.name,
      :date => created_at,
      :description => "Model '#{node.name}' tagged with '#{tag.name}' by '#{person.fullname}'",
      :title => "Model '#{node.name}' tagged with '#{tag.name}' by '#{person.fullname}'",
      :contents => "<p>'#{person.fullname} tagged the '#{node.name}' model</p>"
    }
  end

  def notify_people
    notification_recipients = (node.people + tag.people).uniq
    logger.warn "Notification recipients for tagged node '#{self.inspect}' = '#{notification_recipients}'"
    Notifications.applied_tag(notification_recipients, tag, node).deliver
  end

  def tweet_tagged_node
    return unless node.world_visible?
    Twitter.update("#{person.fullname} tagged '#{node.name}' (#{node.url}), with '#{tag.name}' (#{tag.url}).")
  end

end
<commit_msg>Added HashTag<commit_after># Model to keep track of tag-node joins

class TaggedNode < ActiveRecord::Base
  attr_accessible :comment, :node_id, :tag_id, :person_id

  belongs_to :node
  belongs_to :tag
  belongs_to :person

  validates :node_id, :presence => true
  validates :tag_id, :presence => true
  validates :person_id, :presence => true

  validates :tag_id, :uniqueness => { :scope => [:node_id, :person_id] }

  scope :created_since, lambda { |since| { :conditions => ['created_at >= ? ', since] }}

  after_save :notify_people
  after_save :tweet_tagged_node

  def new_thing
    {:id => id,
      :node_id => node_id,
      :node_name => node.name,
      :date => created_at,
      :description => "Model '#{node.name}' tagged with '#{tag.name}' by '#{person.fullname}'",
      :title => "Model '#{node.name}' tagged with '#{tag.name}' by '#{person.fullname}'",
      :contents => "<p>'#{person.fullname} tagged the '#{node.name}' model</p>"
    }
  end

  def notify_people
    notification_recipients = (node.people + tag.people).uniq
    logger.warn "Notification recipients for tagged node '#{self.inspect}' = '#{notification_recipients}'"
    Notifications.applied_tag(notification_recipients, tag, node).deliver
  end

  def tweet_tagged_node
    return unless node.world_visible?
    Twitter.update("#{person.fullname} tagged #NetLogo model '#{node.name}' (#{node.url}) with '#{tag.name}' (#{tag.url}).")
  end

end

{'fraction_non_alphanumeric': 0.15546218487394958, 'fraction_numerical': 0.0, 'mean_word_length': 4.157039711191335, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 35, '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': '2454678', 'n_tokens_mistral': 988, 'n_tokens_neox': 949, 'n_words': 233}