feat: added submissions history, formatted

This commit is contained in:
Андрей Сумин committed 2025-03-02 03:17:18 +03:00
1 parent cb541b3a2a
commit 696fc8e58b
18 files changed
+130 -78

No files matched your search

@@ -11,12 +11,17 @@ class CompetitionOut(ModelSchema):
state: Literal["not_started", "started", "finished"]
@staticmethod
def resolve_state(self, context) -> Literal["not_started", "started", "finished"]:
if not (state := State.objects.filter(user=context.get("request").auth, competition=self).first()):
def resolve_state(
self, context
) -> Literal["not_started", "started", "finished"]:
if not (
state := State.objects.filter(
user=context.get("request").auth, competition=self
).first()
):
return "not_started"
return state.state
class Meta:
model = Competition
exclude = ("participants",)