<commit_before>class Album 
  require 'lib/common'
  include MongoMapper::Document
  include ROXML
  include Diaspora::Webhooks

  xml_reader :name
  xml_reader :person, :as => Person
  xml_reader :_id
  key :name, String

  belongs_to :person, :class_name => 'Person'
  many :photos, :class_name => 'Photo', :foreign_key => :album_id

  timestamps!

  validates_presence_of :name

  before_destroy :destroy_photos

  def prev_photo(photo)
    n_photo = self.photos.where(:created_at.lt => photo.created_at).sort(:created_at.desc).first
    n_photo ? n_photo : self.photos.sort(:created_at.desc).first
  end

  def next_photo(photo)
    p_photo = self.photos.where(:created_at.gt => photo.created_at).sort(:created_at.asc).first
    p_photo ? p_photo : self.photos.sort(:created_at.desc).last
  end

  protected

  def destroy_photos
    photos.each{|p| p.destroy}
  end

end<commit_msg>Pushing Albums out<commit_after>class Album 
  require 'lib/common'
  include MongoMapper::Document
  include ROXML
  include Diaspora::Webhooks

  xml_reader :name
  xml_reader :person, :as => Person
  xml_reader :_id
  key :name, String

  belongs_to :person, :class_name => 'Person'
  many :photos, :class_name => 'Photo', :foreign_key => :album_id

  timestamps!

  validates_presence_of :name

  before_destroy :destroy_photos
  after_save :notify_people

  def prev_photo(photo)
    n_photo = self.photos.where(:created_at.lt => photo.created_at).sort(:created_at.desc).first
    n_photo ? n_photo : self.photos.sort(:created_at.desc).first
  end

  def next_photo(photo)
    p_photo = self.photos.where(:created_at.gt => photo.created_at).sort(:created_at.asc).first
    p_photo ? p_photo : self.photos.sort(:created_at.desc).last
  end

  protected

  def destroy_photos
    photos.each{|p| p.destroy}
  end

end
{'fraction_non_alphanumeric': 0.11234089651355839, 'fraction_numerical': 0.0, 'mean_word_length': 4.271137026239067, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '1413648', 'n_tokens_mistral': 657, 'n_tokens_neox': 621, 'n_words': 125}