Skip to content

Commit

Permalink
Update types for submissions restrictions and rejudging judgings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicky Gerritsen committed Jan 12, 2024
1 parent 4357f65 commit 68bb5e2
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 35 deletions.
10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ parameters:
count: 1
path: webapp/src/Controller/API/JudgehostController.php

-
message: "#^PHPDoc tag @var for variable \\$judgings has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Controller/API/JudgehostController.php

-
message: "#^Method App\\\\Controller\\\\API\\\\JudgementTypeController\\:\\:getJudgementTypes\\(\\) has parameter \\$filteredOn with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -285,11 +280,6 @@ parameters:
count: 1
path: webapp/src/Controller/Jury/RejudgingController.php

-
message: "#^PHPDoc tag @var for variable \\$judgings has no value type specified in iterable type array\\.$#"
count: 2
path: webapp/src/Controller/Jury/RejudgingController.php

-
message: "#^Method App\\\\Controller\\\\Jury\\\\SubmissionController\\:\\:determineFileChanged\\(\\) has parameter \\$files with no value type specified in iterable type array\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ private function maybeUpdateActiveJudging(Judging $judging): void
$this->em->flush();

$skipped = [];
/** @var array[] $judgings */
/** @var Judging[] $judgings */
$judgings = $this->em->createQueryBuilder()
->from(Judging::class, 'j')
->leftJoin('j.submission', 's')
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/Controller/Jury/RejudgingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ public function viewAction(

$restrictions = ['rejudgingid' => $rejudgingId];
if ($viewTypes[$view] == 'unverified') {
$restrictions['verified'] = 0;
$restrictions['verified'] = false;
}
if ($viewTypes[$view] == 'unjudged') {
$restrictions['judged'] = 0;
$restrictions['judged'] = false;
}
if ($viewTypes[$view] == 'diff') {
$restrictions['rejudgingdiff'] = 1;
$restrictions['rejudgingdiff'] = true;
}
if ($oldverdict !== 'all') {
$restrictions['old_result'] = $oldverdict;
Expand Down Expand Up @@ -604,7 +604,7 @@ public function addAction(Request $request, FormFactoryInterface $formFactory):
}
}

/** @var array[] $judgings */
/** @var Judging[] $judgings */
$judgings = $queryBuilder
->getQuery()
->getResult();
Expand Down Expand Up @@ -733,7 +733,7 @@ public function createAction(Request $request): Response
->setParameter('correct', 'correct');
}

/** @var array[] $judgings */
/** @var Judging[] $judgings */
$judgings = $queryBuilder
->getQuery()
->getResult();
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/Controller/Jury/ShadowDifferencesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,19 @@ public function indexAction(

$restrictions = ['with_external_id' => true];
if ($viewTypes[$view] == 'unjudged local') {
$restrictions['judged'] = 0;
$restrictions['judged'] = false;
}
if ($viewTypes[$view] == 'unjudged external') {
$restrictions['externally_judged'] = 0;
$restrictions['externally_judged'] = false;
}
if ($viewTypes[$view] == 'diff') {
$restrictions['external_diff'] = 1;
$restrictions['external_diff'] = true;
}
if ($verificationViewTypes[$verificationView] == 'unverified') {
$restrictions['externally_verified'] = 0;
$restrictions['externally_verified'] = false;
}
if ($verificationViewTypes[$verificationView] == 'verified') {
$restrictions['externally_verified'] = 1;
$restrictions['externally_verified'] = true;
}
if ($external !== 'all') {
$restrictions['external_result'] = $external;
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/Controller/Jury/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ public function indexAction(

$restrictions = [];
if ($viewTypes[$view] == 'unverified') {
$restrictions['verified'] = 0;
$restrictions['verified'] = false;
}
if ($viewTypes[$view] == 'unjudged') {
$restrictions['judged'] = 0;
$restrictions['judged'] = false;
}
if ($viewTypes[$view] == 'judging') {
$restrictions['judging'] = 1;
$restrictions['judging'] = true;
}

$contests = $this->dj->getCurrentContests();
Expand Down
1 change: 1 addition & 0 deletions webapp/src/Controller/Jury/TeamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public function viewAction(
$restrictionTexts[] = sprintf('%s %s', $restrictionKeyText, $value);
}
$restrictionText = implode(', ', $restrictionTexts);
/** @var array{probid?: int, langid?: string, judgehost?: string, ...} $restrictions */
}
$restrictions['teamid'] = $teamId;
[$submissions, $submissionCounts] =
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Service/CheckConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
}

/**
* @return array<string, array{caption: string, result: string, desc: string, escape?: bool}>
* @return array<string, array<string, array{caption: string, result: string, desc: string, escape?: bool}>>
*/
public function runAll(): array
{
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/Service/ConfigurationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public function all(bool $onlyIfPublic = false): array
/**
* Get all configuration specifications.
*
* @return array<string, array{name: string, type: string, default_value: bool, public: bool,
* description: string, category: string, default_value: bool|int|bool,
* regex?: string, key_placeholder: string, value_placeholder: string,
* @return array<string, array{name: string, type: string, public: bool,
* description: string, category: string, default_value: mixed|mixed[],
* regex?: string, key_placeholder?: string, value_placeholder?: string,
* error_message?: string, docdescription?: string, enum_class?: string,
* options?: array<int|string, string>, key_options?: array<string, string>,
* value_options?: array<string, string>}>
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Service/ScoreboardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ protected function getTeams(Contest $contest, bool $jury = false, Filter $filter
$queryBuilder
->join('t.submissions', 's', Join::WITH, 's.contest = :cid')
->setParameter('cid', $contest->getCid());
}
}
}

if ($filter) {
Expand Down
16 changes: 10 additions & 6 deletions webapp/src/Service/SubmissionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,25 @@ public function __construct(
* - userid: filter on specific user
* - visible: If true, only return submissions from visible teams
* When shadowing another system these keys can also be used:
* - external_diff: Difference with the external system
* - external_diff: If true, only return results with a difference with an
* external system.
* If false, only return results without a difference with an
* external system.
* - external_result: result in the external system
* - externally_judged: If true, only return externally judged submissions.
* If false, only return externally unjudged submissions.
* - externally_verified: If true, only return verified submissions.
* If false, only return unverified or unjudged submissions.
* - with_external_id: id of the submission in the external system
* - with_external_id: If true, only return submissions with an external ID.
*
* @param Contest[] $contests
* @param array{rejudgingid?: int, verified?: bool, judged?: bool, judging?: bool,
* rejudgingdiff?: bool, teamid?: string, categoryid?: string,
* probid?: string, langid?: string, judgehost?: string, old_result?: string,
* result?: string, userid?: string, visible?: bool, external_diff?: string,
* rejudgingdiff?: bool, teamid?: int, categoryid?: int,
* probid?: string|int|null, langid?: string, judgehost?: string, old_result?: string,
* result?: string, userid?: int, visible?: bool, external_diff?: bool,
* external_result?: string, externally_judged?: bool,
* externally_verified?: bool, with_external_id?: string} $restrictions
* externally_verified?: bool, with_external_id?: true} $restrictions
*
* @return array{Submission[], array<string, int>} array An array with
* two elements: the first one is the list of submissions
* and the second one is an array with counts.
Expand Down

0 comments on commit 68bb5e2

Please sign in to comment.