class Student < ActiveRecord::Base
  belongs_to :homeroom, counter_cache: true
  belongs_to :school
  has_many :attendance_results, dependent: :destroy
  has_many :mcas_results, dependent: :destroy
  has_many :star_results, dependent: :destroy
  validates_uniqueness_of :state_id

  def high_risk?
    if mcas_results.present?
     mcas_results.last.warning?
    end
  end

  def medium_risk?
    if mcas_results.present?
      last_result = mcas_results.last
      last_result.ela_performance == "NI" || last_result.math_performance == "NI"
    end
  end

  def low_risk?
    !medium_risk? && !high_risk?
  end

end
class Student < ActiveRecord::Base
  belongs_to :homeroom, counter_cache: true
  belongs_to :school
  has_many :attendance_results, dependent: :destroy
  has_many :mcas_results, dependent: :destroy
  has_many :star_results, dependent: :destroy
  validates_uniqueness_of :state_id

  def high_risk?
    if mcas_results.present?
     mcas_results.last.warning?
    end
  end

  def medium_risk?
    if !high_risk? && mcas_results.present?
      last_result = mcas_results.last
      last_result.ela_performance == "NI" || last_result.math_performance == "NI"
    end
  end

  def low_risk?
    !medium_risk? && !high_risk?
  end

end
Fix duplication in the risk analyzer
Fix duplication in the risk analyzer

+ high risk, medium risk, and low risk need to be mutually exclusive
+ we're ditching the whole risk analysis module in the next round anyway so not work testing
+ resolves #62
