fix cap points for prestige

This commit is contained in:
Gabriel Augendre 2024-01-10 10:14:24 +01:00
parent acd0ade1ad
commit 2fec5b32da
4 changed files with 10 additions and 4 deletions

View file

@ -25,7 +25,7 @@
<excludeFolder url="file://$MODULE_DIR$/.ruff_cache" /> <excludeFolder url="file://$MODULE_DIR$/.ruff_cache" />
<excludeFolder url="file://$MODULE_DIR$/.venv" /> <excludeFolder url="file://$MODULE_DIR$/.venv" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.11 (charasheet)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.12 (charasheet)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PyDocumentationSettings"> <component name="PyDocumentationSettings">

View file

@ -3,5 +3,5 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.11 (charasheet)" /> <option name="sdkName" value="Python 3.11 (charasheet)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (charasheet)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (charasheet)" project-jdk-type="Python SDK" />
</project> </project>

View file

@ -130,7 +130,7 @@ class Capability(DocumentedModel, TimeStampedModel, models.Model):
@property @property
def capability_points_cost(self) -> int: 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 1
return 2 return 2

View file

@ -413,7 +413,13 @@ class Character(models.Model):
@property @property
def capability_points_used(self) -> int: 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 @property
def capability_points_remaining(self) -> int: def capability_points_remaining(self) -> int: