class Accounting::StudentMatrixDecorator < ApplicationDecorator
  def primary_percentage
    if primary.nil?
      100
    elsif primary.zero?
      0
    else
      primary.round
    end
  end

  def secondary_percentage
    return 0 if primary.nil?

    percent = 100 - (primary.round || 0)
    percent.zero? ? 0 : percent
  end
end
