Compare commits

...

8 Commits

10 changed files with 53 additions and 15 deletions

5
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM mcr.microsoft.com/devcontainers/python:3.11-bullseye
RUN apt-get update && apt-get upgrade -y
RUN pip install pip-tools invoke
COPY requirements.in requirements.txt requirements-dev.in requirements-dev.txt constraints.txt tasks.py ./
RUN invoke sync-dependencies

View File

@ -0,0 +1,7 @@
{
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"postStartCommand": "inv sync-dependencies && pre-commit install --install-hooks"
}

25
.idea/jsonSchemas.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JsonSchemaMappingsProjectConfiguration">
<state>
<map>
<entry key="devcontainer.json">
<value>
<SchemaInfo>
<option name="name" value="devcontainer.json" />
<option name="relativePathToSchema" value="https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json" />
<option name="applicationDefined" value="true" />
<option name="patterns">
<list>
<Item>
<option name="path" value=".devcontainer/devcontainer.json" />
</Item>
</list>
</option>
</SchemaInfo>
</value>
</entry>
</map>
</state>
</component>
</project>

View File

@ -40,7 +40,7 @@ repos:
hooks:
- id: djhtml
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.257
rev: v0.0.259
hooks:
- id: ruff
args: [--fix]

View File

@ -55,7 +55,7 @@ idna==3.4
# via
# requests
# trio
markdown==3.4.1
markdown==3.4.3
# via -r requirements.in
outcome==1.2.0
# via trio
@ -67,7 +67,7 @@ requests==2.28.2
# via
# -r requirements.in
# django-anymail
selenium==4.8.2
selenium==4.8.3
# via -r requirements.in
sniffio==1.3.0
# via trio

View File

@ -56,6 +56,7 @@ ignore = [
"B011", # Do not call assert False since python -O removes these calls.
"ARG001", # Unused function argument (mostly fixtures)
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes.
]
# File {name} is part of an implicit namespace package. Add an `__init__.py`.
"tasks.py" = ["INP001"]

View File

@ -66,7 +66,7 @@ exceptiongroup==1.1.1
# via
# -c constraints.txt
# trio-websocket
filelock==3.10.0
filelock==3.10.4
# via virtualenv
freezegun==1.2.2
# via -r requirements-dev.in
@ -78,7 +78,7 @@ h11==0.14.0
# wsproto
hypothesis==6.70.0
# via -r requirements-dev.in
identify==2.5.21
identify==2.5.22
# via pre-commit
idna==3.4
# via
@ -166,9 +166,9 @@ requests==2.28.2
# bpython
# pytest-base-url
# pytest-selenium
ruff==0.0.257
ruff==0.0.259
# via -r requirements-dev.in
selenium==4.8.2
selenium==4.8.3
# via
# -c constraints.txt
# pytest-selenium

View File

@ -55,7 +55,7 @@ idna==3.4
# via
# requests
# trio
markdown==3.4.1
markdown==3.4.3
# via -r requirements.in
outcome==1.2.0
# via trio
@ -67,7 +67,7 @@ requests==2.28.2
# via
# -r requirements.in
# django-anymail
selenium==4.8.2
selenium==4.8.3
# via -r requirements.in
sniffio==1.3.0
# via trio

View File

@ -304,12 +304,12 @@ class Character(models.Model):
def __str__(self):
return self.name
def natural_key(self):
return (self.name, self.player_id)
def get_absolute_url(self):
return reverse("character:view", kwargs={"pk": self.pk})
def natural_key(self):
return (self.name, self.player_id)
@property
def modifier_strength(self) -> int:
return modifier(self.value_strength)

View File

@ -123,12 +123,12 @@ class BattleEffect(TimeStampedModel, models.Model):
objects = BattleEffectManager.from_queryset(BattleEffectQuerySet)()
def __str__(self):
return self.name
@property
def remaining_percent(self) -> float:
max_display_percent = 5
if self.remaining_rounds >= max_display_percent or self.remaining_rounds < 0:
return 100
return self.remaining_rounds / max_display_percent * 100
def __str__(self):
return self.name