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-8.6.0 app/models/user_stats.rb
mumuki-domain-8.5.0 app/models/user_stats.rb
mumuki-domain-8.4.0 app/models/user_stats.rb
mumuki-domain-8.3.1 app/models/user_stats.rb
mumuki-domain-8.2.0 app/models/user_stats.rb
mumuki-domain-8.1.3 app/models/user_stats.rb
mumuki-domain-8.1.2 app/models/user_stats.rb
mumuki-domain-8.1.1 app/models/user_stats.rb
mumuki-domain-8.1.0 app/models/user_stats.rb
mumuki-domain-8.0.0 app/models/user_stats.rb
mumuki-domain-7.12.2 app/models/user_stats.rb
mumuki-domain-7.12.1 app/models/user_stats.rb
mumuki-domain-7.12.0 app/models/user_stats.rb
mumuki-domain-7.11.1 app/models/user_stats.rb
mumuki-laboratory-7.11.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-c92f2a7212e2/app/models/user_stats.rb
mumuki-laboratory-7.11.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-2e15c3330133/app/models/user_stats.rb
mumuki-domain-7.11.0 app/models/user_stats.rb
mumuki-domain-7.10.1 app/models/user_stats.rb
mumuki-domain-7.10.0 app/models/user_stats.rb
mumuki-laboratory-7.9.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-7082a83493eb/app/models/user_stats.rb