diff --git a/cms/db/contest.py b/cms/db/contest.py index d76fc8fea0..0cdaadd540 100644 --- a/cms/db/contest.py +++ b/cms/db/contest.py @@ -206,12 +206,6 @@ class Contest(Base): Unicode, nullable=True) - # Max contest time for each user in seconds. - per_user_time: timedelta | None = Column( - Interval, - CheckConstraint("per_user_time >= '0 seconds'"), - nullable=True) - # Maximum number of submissions or user_tests allowed for each user # during the whole contest or None to not enforce this limitation. max_submission_number: int | None = Column( diff --git a/cms/server/contest/submission/check.py b/cms/server/contest/submission/check.py index 646d943852..8f6d5c23c2 100644 --- a/cms/server/contest/submission/check.py +++ b/cms/server/contest/submission/check.py @@ -220,10 +220,10 @@ def is_last_minutes(timestamp: datetime, participation: Participation): or participation.contest.min_submission_interval_grace_period is None: return False - if participation.contest.per_user_time is None: - end_time = participation.contest.stop + if participation.group.per_user_time is None: + end_time = participation.group.stop else: - end_time = participation.starting_time + participation.contest.per_user_time + end_time = participation.starting_time + participation.group.per_user_time end_time += participation.delay_time + participation.extra_time time_left = end_time - timestamp diff --git a/cms/server/contest/templates/contest_list.html b/cms/server/contest/templates/contest_list.html index 4a097a94ec..6068819831 100644 --- a/cms/server/contest/templates/contest_list.html +++ b/cms/server/contest/templates/contest_list.html @@ -8,7 +8,7 @@

{% trans %}Choose a contest{% endtrans %}

diff --git a/cmscontrib/updaters/update_from_1.5.sql b/cmscontrib/updaters/update_from_1.5.sql index 306f6ebdfe..0484bf61b3 100644 --- a/cmscontrib/updaters/update_from_1.5.sql +++ b/cmscontrib/updaters/update_from_1.5.sql @@ -102,4 +102,7 @@ ALTER TABLE contests DROP COLUMN analysis_enabled; ALTER TABLE contests DROP COLUMN analysis_start; ALTER TABLE contests DROP COLUMN analysis_stop; +-- https://github.com/cms-dev/cms/pull/1672 +ALTER TABLE contests DROP COLUMN per_user_time; + COMMIT; diff --git a/cmstestsuite/unit_tests/server/contest/submission/check_test.py b/cmstestsuite/unit_tests/server/contest/submission/check_test.py index 18737a5ff2..671b7b738a 100755 --- a/cmstestsuite/unit_tests/server/contest/submission/check_test.py +++ b/cmstestsuite/unit_tests/server/contest/submission/check_test.py @@ -430,9 +430,9 @@ def test_no_per_user_time_and_not_last_minutes(self): is_last_minutes(self.timestamp - timedelta(minutes=15), self.participation)) def test_per_user_time_and_last_minutes(self): - self.participation.contest.per_user_time = timedelta(hours=5) - self.participation.contest.start = self.timestamp - timedelta(hours=10) - self.participation.contest.stop = self.timestamp + self.participation.group.per_user_time = timedelta(hours=5) + self.participation.group.start = self.timestamp - timedelta(hours=10) + self.participation.group.stop = self.timestamp self.participation.starting_time = self.timestamp - timedelta(hours=5) self.contest.min_submission_interval_grace_period = timedelta(minutes=15) @@ -440,9 +440,9 @@ def test_per_user_time_and_last_minutes(self): is_last_minutes(self.timestamp - timedelta(minutes=15), self.participation)) def test_per_user_time_and_not_last_minutes(self): - self.participation.contest.per_user_time = timedelta(hours=5) - self.participation.contest.start = self.timestamp - timedelta(hours=10) - self.participation.contest.stop = self.timestamp + self.participation.group.per_user_time = timedelta(hours=5) + self.participation.group.start = self.timestamp - timedelta(hours=10) + self.participation.group.stop = self.timestamp self.participation.starting_time = self.timestamp - timedelta(hours=5) self.contest.min_submission_interval_grace_period = timedelta(minutes=10) @@ -474,9 +474,9 @@ def test_unrestricted_participation(self): self.assertFalse(is_last_minutes(self.timestamp, self.participation)) def setup_contest_with_no_user_time(self): - self.participation.contest.per_user_time = None - self.participation.contest.start = self.timestamp - timedelta(hours=5) - self.participation.contest.stop = self.timestamp + self.participation.group.per_user_time = None + self.participation.group.start = self.timestamp - timedelta(hours=5) + self.participation.group.stop = self.timestamp if __name__ == "__main__":