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 | |
parent | 8ef52586c72cb81df2632de6c0b5bce9368f1fa5 (diff) |
Fix bug where aspirant title wouldn't be awarded until TL 101
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | app/models/character_skill.rb | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b3680..da85786 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.1.8.2] - 2021-06-07 + +### Fixed +- Aspirant title would not be awarded until gaining 101 TL due to a bug. + ## [0.1.8.1] - 2021-06-06 ### Combat 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 |