Sha256: bade43b4f89c425cb71f52904b70335aecf8b05756d4161b2a36ae9db2c31733

Contents?: true

Size: 1 KB

Versions: 10

Compression:

Stored size: 1 KB

Contents

class ChecksumAuditLog < ActiveRecord::Base
  attr_accessible :pass, :pid, :dsid, :version, :created_at if Rails::VERSION::MAJOR == 3

  def ChecksumAuditLog.get_audit_log(version)
    ChecksumAuditLog.find_or_create_by_pid_and_dsid_and_version(:pid => version.pid,
                                                                :dsid => version.dsid,
                                                                :version => version.versionID)
  end

  def ChecksumAuditLog.prune_history(version)
    ## Check to see if there are previous passing logs that we can delete
    # we want to keep the first passing event after a failure, the most current passing event, and all failures so that this table doesn't grow too large
    # Simple way (a little naieve): if the last 2 were passing, delete the first one
    logs = GenericFile.load_instance_from_solr(version.pid).logs(version.dsid)
    list = logs.limit(2)
    if list.size > 1 && (list[0].pass == 1) && (list[1].pass == 1)
      list[0].destroy
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
sufia-3.1.3 sufia-models/app/models/checksum_audit_log.rb
sufia-models-3.1.3 app/models/checksum_audit_log.rb
sufia-3.1.2 sufia-models/app/models/checksum_audit_log.rb
sufia-models-3.1.2 app/models/checksum_audit_log.rb
sufia-3.1.1 sufia-models/app/models/checksum_audit_log.rb
sufia-models-3.1.1 app/models/checksum_audit_log.rb
sufia-3.1.0 sufia-models/app/models/checksum_audit_log.rb
sufia-models-3.1.0 app/models/checksum_audit_log.rb
sufia-3.0.0 sufia-models/app/models/checksum_audit_log.rb
sufia-models-3.0.0 app/models/checksum_audit_log.rb