diff --git a/.idea/charasheet.iml b/.idea/charasheet.iml index 6f914ee..e6ff662 100644 --- a/.idea/charasheet.iml +++ b/.idea/charasheet.iml @@ -25,7 +25,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 9cb90e7..6b28abe 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/src/character/models/capabilities.py b/src/character/models/capabilities.py index b16b87b..85d2cbe 100644 --- a/src/character/models/capabilities.py +++ b/src/character/models/capabilities.py @@ -130,7 +130,7 @@ class Capability(DocumentedModel, TimeStampedModel, models.Model): @property def capability_points_cost(self) -> int: - if self.rank in [1, 2]: + if self.path.category == Path.Category.PROFILE and self.rank in [1, 2]: return 1 return 2 diff --git a/src/character/models/character.py b/src/character/models/character.py index dadb869..6eeceee 100644 --- a/src/character/models/character.py +++ b/src/character/models/character.py @@ -413,7 +413,13 @@ class Character(models.Model): @property def capability_points_used(self) -> int: - return sum(cap.capability_points_cost for cap in self.capabilities.only("rank")) + return sum( + cap.capability_points_cost + for cap in self.capabilities.select_related("path").only( + "rank", + "path__category", + ) + ) @property def capability_points_remaining(self) -> int: