karma.rb 291 B

123456789101112
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. class Karma
  3. def self.score_by_user(user)
  4. last_activity_log = Karma::ActivityLog.where(user_id: user.id).order(id: :desc).first
  5. return 0 if !last_activity_log
  6. last_activity_log.score_total
  7. end
  8. end