Sha256: ce700f45261ad75072257a71cba5b2694f4ebfd6d5040c274f4394854fd26ba4

Contents?: true

Size: 318 Bytes

Versions: 25

Compression:

Stored size: 318 Bytes

Contents

class UserStats < ApplicationRecord
  belongs_to :organization
  belongs_to :user

  def self.stats_for(user)
    UserStats.find_or_initialize_by(user: user, organization: Organization.current)
  end

  def self.exp_for(user)
    self.stats_for(user).exp
  end

  def add_exp!(points)
    self.exp += points
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
mumuki-domain-7.9.2 app/models/user_stats.rb
mumuki-laboratory-7.9.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-b162dc91aa77/app/models/user_stats.rb
mumuki-domain-7.9.1 app/models/user_stats.rb
mumuki-laboratory-7.9.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-520f859ca8af/app/models/user_stats.rb
mumuki-domain-7.9.0 app/models/user_stats.rb