This commit is contained in:
2026-06-29 06:41:18 -06:00
parent c1ec9eab8f
commit 180d75cb97
3 changed files with 10 additions and 7 deletions

View File

@@ -127,7 +127,7 @@ def check_contest_permission(check_type="details"):
return None
if self.contest.contest_type == ContestType.PASSWORD_PROTECTED_CONTEST:
if not check_contest_password(request.session.get(CONTEST_PASSWORD_SESSION_KEY, {}).get(self.contest.id), self.contest.password):
if not check_contest_password(request.session.get(CONTEST_PASSWORD_SESSION_KEY, {}).get(str(self.contest.id)), self.contest.password):
return self.error("Wrong password or password expired")
if self.contest.status == ContestStatus.CONTEST_NOT_START and check_type != "details":

View File

@@ -94,7 +94,7 @@ class ContestPasswordVerifyAPI(AsyncAPIView):
if CONTEST_PASSWORD_SESSION_KEY not in request.session:
request.session[CONTEST_PASSWORD_SESSION_KEY] = {}
request.session[CONTEST_PASSWORD_SESSION_KEY][contest.id] = data["password"]
request.session[CONTEST_PASSWORD_SESSION_KEY][str(contest.id)] = data["password"]
request.session.modified = True
return self.success(True)
@@ -112,7 +112,7 @@ class ContestAccessAPI(AsyncAPIView):
except Contest.DoesNotExist:
return self.error("Contest does not exist")
session_pass = request.session.get(CONTEST_PASSWORD_SESSION_KEY, {}).get(
contest.id
str(contest.id)
)
return self.success(
{"access": check_contest_password(session_pass, contest.password)}

View File

@@ -11,7 +11,7 @@ from django.utils import timezone
from account.models import User
from conf.models import JudgeServer
from contest.models import ACMContestRank, ContestStatus
from contest.models import ACMContestRank
from options.options import SysOptions
from problem.models import Problem, ProblemRuleType
from problem.utils import parse_problem_template
@@ -238,7 +238,10 @@ class JudgeDispatcher(DispatcherBase):
logger.error(f"Failed to push submission update: {str(e)}")
if self.contest_id:
if self.contest.status != ContestStatus.CONTEST_UNDERWAY or \
# 以提交时刻(而非判题时刻)是否落在比赛时间窗内为准,
# 避免临界提交因判题排队延迟到比赛结束后才处理而被丢弃
in_contest = self.contest.start_time <= self.submission.create_time <= self.contest.end_time
if not in_contest or \
User.objects.get(id=self.submission.user_id).is_contest_admin(self.contest):
logger.info(
"Contest debug mode, id: " + str(self.contest_id) + ", submission id: " + self.submission.id)
@@ -397,7 +400,7 @@ class JudgeDispatcher(DispatcherBase):
if is_accepted(self.submission.result):
rank.accepted_number += 1
info["is_ac"] = True
info["ac_time"] = (self.submission.create_time - self.contest.start_time).total_seconds()
info["ac_time"] = int((self.submission.create_time - self.contest.start_time).total_seconds())
rank.total_time += info["ac_time"] + info["error_number"] * 20 * 60
if problem.accepted_number == 1:
@@ -412,7 +415,7 @@ class JudgeDispatcher(DispatcherBase):
if is_accepted(self.submission.result):
rank.accepted_number += 1
info["is_ac"] = True
info["ac_time"] = (self.submission.create_time - self.contest.start_time).total_seconds()
info["ac_time"] = int((self.submission.create_time - self.contest.start_time).total_seconds())
rank.total_time += info["ac_time"]
if problem.accepted_number == 1: