class RcAccountabilitySptaEvaluation < ActiveRecord::Base
  attr_accessible :internal_score, :spta_score, :rc_accountability_resource_id, :institution_id, :institution_dependence_id
  attr_accessible :document
  attr_accessor :average_score

  belongs_to :rc_accountability_resource
  belongs_to :institution
  belongs_to :institution_dependence

  validates :internal_score, :presence => true
  validates :spta_score, :presence => true
  validates :rc_accountability_resource_id, uniqueness: { scope: [:institution_id, :institution_dependence_id]}

  def average_score
    return (internal_score + spta_score) / 2
  end

  def self.per_page
    25
  end

end