From f4ab4f5af22c2cacb6aacee7954824f97735bdc7 Mon Sep 17 00:00:00 2001 From: David Gay Date: Mon, 7 Jun 2021 16:04:22 -0400 Subject: Fix bug where aspirant title wouldn't be awarded until TL 101 --- app/models/character_skill.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app') 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 -- cgit v1.2.3