class Kapsme < ActiveRecord::Base
  belongs_to :kap
  belongs_to :p_customer
  
  has_many :kaps_rappels, :through => :kap
  
  def kaps_type
    if self.kaps_type_id == 1
      "Journalier"
    elsif self.kaps_type_id == 2
      "Hebdomadaire"
    else
      "Mensuel"
    end
    
    
  end
  
  
  before_save do
    if self.paused
      self.point_to_count = 0
    else
      self.point_to_count = self.points
    end
  end
  
  
  belongs_to :kaps_day
  
end
