Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove JudgehostRestriction feature #1137

Merged
merged 5 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Version 8.0.0 - DEV
- Improve API action to add submission to adhere to the CCS spec.
- Add API action to create clarification following CCS spec.
- Add support for showing (pending) awards on the scoreboard. Thanks @shuibinlong!
- Remove JudgehostRestriction feature due to new Judgehost API


Version 7.3.2 - 23 November 2020
Expand Down
22 changes: 0 additions & 22 deletions webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1137,28 +1137,6 @@ private function getSubmissionsToJudge(Judgehost $judgehost, $restrictJudgingOnS
->addOrderBy('s.submittime', 'ASC')
->addOrderBy('s.submitid', 'ASC');

// Apply restrictions
if ($judgehost->getRestriction()) {
$restrictions = $judgehost->getRestriction()->getRestrictions();

if (isset($restrictions['contest'])) {
$queryBuilder
->andWhere('s.contest IN (:restrictionContestIds)')
->setParameter(':restrictionContestIds', $restrictions['contest']);
}

if (isset($restrictions['problem'])) {
$queryBuilder
->andWhere('s.problem IN (:restrictionProblemIds)')
->setParameter(':restrictionProblemIds', $restrictions['problem']);
}

if (isset($restrictions['language'])) {
$queryBuilder
->andWhere('s.language IN (:restrictionLanguageIds)')
->setParameter(':restrictionLanguageIds', $restrictions['language']);
}
}
if ($restrictJudgingOnSameJudgehost) {
$queryBuilder
->leftJoin('s.judgings', 'j', Join::WITH, 'j.judgehost = :judgehost')
Expand Down
2 changes: 0 additions & 2 deletions webapp/src/Controller/Jury/AuditLogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ private function generateDatatypeUrl(string $type, $id): ?string
return $this->generateUrl('jury_judgehosts');
case 'judgehosts':
return $this->generateUrl('jury_judgehosts');
case 'judgehost_restriction':
return $this->generateUrl('jury_judgehost_restriction', ['restrictionId' => $id]);
case 'judging':
return $this->generateUrl('jury_submission_by_judging', ['jid' => $id]);
case 'external_judgement':
Expand Down
13 changes: 0 additions & 13 deletions webapp/src/Controller/Jury/ContestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,20 +675,13 @@ public function prefetchAction(Request $request, int $contestId)
$cnt = 0;
foreach ($judgehosts as $judgehost) {
/** @var Judgehost $judgehost */
$judgehostRestriction = $judgehost->getRestriction();
foreach ($contest->getProblems() as $contestProblem) {
/** @var ContestProblem $contestProblem */
if (!$contestProblem->getAllowJudge() || !$contestProblem->getAllowSubmit()) {
continue;
}
/** @var Problem $problem */
$problem = $contestProblem->getProblem();
if ($judgehostRestriction !== null) {
$restrictedProblems = $judgehostRestriction->getProblems();
if (!empty($restrictedProblems) && !in_array($problem->getProbid(), $restrictedProblems)) {
continue;
}
}
foreach ($problem->getTestcases() as $testcase) {
/** @var Testcase $testcase */
$judgeTask = new JudgeTask();
Expand Down Expand Up @@ -723,12 +716,6 @@ public function prefetchAction(Request $request, int $contestId)
);
foreach ($languages as $language) {
/** @var Language $language */
if ($judgehostRestriction !== null) {
$restrictedLangs = $judgehostRestriction->getLanguages();
if (!empty($restrictedLangs) && !in_array($language->getLangid(), $restrictedLangs)) {
continue;
}
}
$compileExec = $language->getCompileExecutable()->getImmutableExecutable();
$judgeTask = new JudgeTask();
$judgeTask
Expand Down
13 changes: 3 additions & 10 deletions webapp/src/Controller/Jury/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public function indexAction(Request $request): Response
/** @var Judgehost[] $judgehosts */
$judgehosts = $this->em->createQueryBuilder()
->from(Judgehost::class, 'j')
->leftJoin('j.restriction', 'r')
->select('j', 'r')
->select('j')
->andWhere('j.hidden = 0')
->orderBy('j.hostname')
->getQuery()->getResult();
Expand All @@ -92,7 +91,6 @@ public function indexAction(Request $request): Response
'hostname' => ['title' => 'hostname'],
'active' => ['title' => 'active'],
'status' => ['title' => 'status'],
'restriction' => ['title' => 'restriction'],
'load' => ['title' => 'load'],
'last_judgingid' => ['title' => 'last judging'],
];
Expand Down Expand Up @@ -207,9 +205,6 @@ public function indexAction(Request $request): Response
'active' => [
'value' => $judgehost->getActive() ? 'yes' : 'no',
],
'restriction' => [
'value' => $judgehost->getRestriction() ? $judgehost->getRestriction()->getName() : '<i>none</i>',
],
]);

// Create action links
Expand Down Expand Up @@ -275,8 +270,7 @@ public function viewAction(Request $request, int $judgehostid): Response
/** @var Judgehost $judgehost */
$judgehost = $this->em->createQueryBuilder()
->from(Judgehost::class, 'j')
->leftJoin('j.restriction', 'r')
->select('j', 'r')
->select('j')
->andWhere('j.judgehostid = :judgehostid')
->setParameter(':judgehostid', $judgehostid)
->getQuery()
Expand Down Expand Up @@ -341,8 +335,7 @@ public function deleteAction(Request $request, int $judgehostid): Response
/** @var Judgehost $judgehost */
$judgehost = $this->em->createQueryBuilder()
->from(Judgehost::class, 'j')
->leftJoin('j.restriction', 'r')
->select('j', 'r')
->select('j')
->andWhere('j.judgehostid = :judgehostid')
->setParameter(':judgehostid', $judgehostid)
->getQuery()
Expand Down
259 changes: 0 additions & 259 deletions webapp/src/Controller/Jury/JudgehostRestrictionController.php

This file was deleted.

Loading