diff --git a/web/app/models/UOJBlog.php b/web/app/models/UOJBlog.php index 480e8db..caeb620 100644 --- a/web/app/models/UOJBlog.php +++ b/web/app/models/UOJBlog.php @@ -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; } } diff --git a/web/app/models/UOJProblem.php b/web/app/models/UOJProblem.php index 402aa61..48fc537 100644 --- a/web/app/models/UOJProblem.php +++ b/web/app/models/UOJProblem.php @@ -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 []; } diff --git a/web/app/models/UOJSubmission.php b/web/app/models/UOJSubmission.php index d7499e9..34570ee 100644 --- a/web/app/models/UOJSubmission.php +++ b/web/app/models/UOJSubmission.php @@ -392,8 +392,6 @@ class UOJSubmission { $perm[$com] = false; } - // TODO: hide older submissions when a registered unfinished contest has this problem - return $perm; }