Module: Gamified

Included in:
Assignment
Defined in:
app/models/concerns/gamified.rb

Instance Method Summary collapse

Instance Method Details

#award_experience_points!Object



2
3
4
5
6
7
8
9
10
# File 'app/models/concerns/gamified.rb', line 2

def award_experience_points!
  points = net_experience

  if points > 0
    stats = UserStats.stats_for(submitter)
    stats.add_exp!(points)
    stats.save!
  end
end

#net_experienceObject



12
13
14
# File 'app/models/concerns/gamified.rb', line 12

def net_experience
  submitter.currently_in_exam? ? 0 : (submission_status.exp_given - top_submission_status.exp_given)
end