mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-25 21:58:41 +00:00
feat(web/submissions): hide older submissions when a registered unfinished contest has this problem
This commit is contained in:
parent
e2fbd6afe9
commit
738b819b5f
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 [];
|
||||
}
|
||||
|
||||
|
@ -392,8 +392,6 @@ class UOJSubmission {
|
||||
$perm[$com] = false;
|
||||
}
|
||||
|
||||
// TODO: hide older submissions when a registered unfinished contest has this problem
|
||||
|
||||
return $perm;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user