From 091c662b3b22794d053657aa32659a96ba670c2b Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Wed, 14 Aug 2024 19:34:29 +0700 Subject: [PATCH] Add limit for contest time limit --- judge/models/contest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/judge/models/contest.py b/judge/models/contest.py index 5903276..e775d8d 100644 --- a/judge/models/contest.py +++ b/judge/models/contest.py @@ -375,6 +375,10 @@ class Contest(models.Model, PageVotable, Bookmarkable): if self.end_time > one_year_later: self.end_time = one_year_later + max_duration = timedelta(days=7) + if self.time_limit and self.time_limit > max_duration: + self.time_limit = max_duration + super().save(*args, **kwargs) def is_in_contest(self, user):