diff options
author | David Gay <david@davidgay.org> | 2021-06-07 16:04:22 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-07 16:04:22 -0400 |
commit | f4ab4f5af22c2cacb6aacee7954824f97735bdc7 (patch) | |
tree | 20463251db2c1e6ea8f6349ffab6ee6664e3583c /app | |
parent | 8ef52586c72cb81df2632de6c0b5bce9368f1fa5 (diff) |
Fix bug where aspirant title wouldn't be awarded until TL 101
Diffstat (limited to 'app')
-rw-r--r-- | app/models/character_skill.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/character_skill.rb b/app/models/character_skill.rb index 84c538e..368cc28 100644 --- a/app/models/character_skill.rb +++ b/app/models/character_skill.rb @@ -74,8 +74,9 @@ class CharacterSkill < ApplicationRecord end def award_titles - if CharacterSkill.level_for_xp(self.xp_was) < CharacterSkill.level_for_xp(xp) - if character.character_skills.to_a.sum(&:level) >= 100 + new_level = CharacterSkill.level_for_xp(xp) + if CharacterSkill.level_for_xp(self.xp_was) < new_level + if character.character_skills.where.not(id: self.id).to_a.sum(&:level) + new_level >= 100 character.award_title("aspirant") end end |