Move problem clarification to contest clarification
This commit is contained in:
parent
f001ae4e0a
commit
0ee7de1b46
11 changed files with 115 additions and 79 deletions
|
@ -15,6 +15,7 @@ from judge.models.contest import (
|
|||
ContestSubmission,
|
||||
ContestTag,
|
||||
Rating,
|
||||
ContestProblemClarification,
|
||||
)
|
||||
from judge.models.interface import BlogPost, MiscConfig, NavigationBar, validate_regex
|
||||
from judge.models.message import PrivateMessage, PrivateMessageThread
|
||||
|
@ -23,7 +24,6 @@ from judge.models.problem import (
|
|||
LanguageTemplate,
|
||||
License,
|
||||
Problem,
|
||||
ProblemClarification,
|
||||
ProblemGroup,
|
||||
ProblemTranslation,
|
||||
ProblemType,
|
||||
|
|
|
@ -29,6 +29,7 @@ __all__ = [
|
|||
"ContestProblem",
|
||||
"ContestSubmission",
|
||||
"Rating",
|
||||
"ContestProblemClarification",
|
||||
]
|
||||
|
||||
|
||||
|
@ -766,6 +767,10 @@ class ContestProblem(models.Model):
|
|||
],
|
||||
)
|
||||
|
||||
@property
|
||||
def clarifications(self):
|
||||
return ContestProblemClarification.objects.filter(problem=self)
|
||||
|
||||
class Meta:
|
||||
unique_together = ("problem", "contest")
|
||||
verbose_name = _("contest problem")
|
||||
|
@ -853,3 +858,13 @@ class ContestMoss(models.Model):
|
|||
unique_together = ("contest", "problem", "language")
|
||||
verbose_name = _("contest moss result")
|
||||
verbose_name_plural = _("contest moss results")
|
||||
|
||||
|
||||
class ContestProblemClarification(models.Model):
|
||||
problem = models.ForeignKey(
|
||||
ContestProblem, verbose_name=_("clarified problem"), on_delete=CASCADE
|
||||
)
|
||||
description = models.TextField(verbose_name=_("clarification body"))
|
||||
date = models.DateTimeField(
|
||||
verbose_name=_("clarification timestamp"), auto_now_add=True
|
||||
)
|
||||
|
|
|
@ -28,7 +28,6 @@ __all__ = [
|
|||
"ProblemType",
|
||||
"Problem",
|
||||
"ProblemTranslation",
|
||||
"ProblemClarification",
|
||||
"License",
|
||||
"Solution",
|
||||
"TranslatedProblemQuerySet",
|
||||
|
@ -490,10 +489,6 @@ class Problem(models.Model):
|
|||
def i18n_name(self, value):
|
||||
self._i18n_name = value
|
||||
|
||||
@property
|
||||
def clarifications(self):
|
||||
return ProblemClarification.objects.filter(problem=self)
|
||||
|
||||
def update_stats(self):
|
||||
self.user_count = (
|
||||
self.submission_set.filter(
|
||||
|
@ -613,16 +608,6 @@ class ProblemTranslation(models.Model):
|
|||
verbose_name_plural = _("problem translations")
|
||||
|
||||
|
||||
class ProblemClarification(models.Model):
|
||||
problem = models.ForeignKey(
|
||||
Problem, verbose_name=_("clarified problem"), on_delete=CASCADE
|
||||
)
|
||||
description = models.TextField(verbose_name=_("clarification body"))
|
||||
date = models.DateTimeField(
|
||||
verbose_name=_("clarification timestamp"), auto_now_add=True
|
||||
)
|
||||
|
||||
|
||||
class LanguageLimit(models.Model):
|
||||
problem = models.ForeignKey(
|
||||
Problem,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue