feat(web/submissions): hide older submissions when a registered unfinished contest has this problem

This commit is contained in:
Baoshuo Ren 2022-11-12 10:20:28 +08:00
parent e2fbd6afe9
commit 738b819b5f
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 17 additions and 3 deletions

View File

@ -42,7 +42,7 @@ class UOJBlog {
$contests = UOJContest::queryContestsHasProblem(UOJProblem::query($problem_id));
foreach ($contests as $contest) {
if ($contest->userHasRegistered($user) && $contest->progress() <= CONTEST_IN_PROGRESS) {
if ($contest->userHasRegistered($user) && $contest->progress() == CONTEST_IN_PROGRESS) {
return false;
}
}

View File

@ -326,6 +326,22 @@ class UOJProblem {
}
public function additionalSubmissionComponentsCannotBeSeenByUser(array $user = null, UOJSubmission $submission) {
$contests = UOJContest::queryContestsHasProblem($this);
foreach ($contests as $contest) {
if ($contest->userHasRegistered($user) && $contest->progress() == CONTEST_IN_PROGRESS) {
if ($submission->userIsSubmitter($user)) {
if ($contest->getJudgeTypeInContest() == 'no-details') {
return ['low_level_details'];
} else {
return [];
}
} else {
return ['content', 'high_level_details', 'low_level_details'];
}
}
}
return [];
}

View File

@ -392,8 +392,6 @@ class UOJSubmission {
$perm[$com] = false;
}
// TODO: hide older submissions when a registered unfinished contest has this problem
return $perm;
}