Skip to content

Commit

Permalink
Remove scoreboard tsv (DOMjudge#1358)
Browse files Browse the repository at this point in the history
* Remove the TSV scoreboard export

DOMjudge 8.0 is a major release so the right moment to remove
functionality. According to the spec this is not needed anymore.

* Address Thijs' review comment.

Co-authored-by: MCJ Vasseur <[email protected]>
Co-authored-by: Tobias Werth <[email protected]>
  • Loading branch information
3 people committed Nov 29, 2021
1 parent 5aca0b7 commit cfcc227
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 66 deletions.
5 changes: 1 addition & 4 deletions webapp/src/Controller/Jury/ImportExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function indexAction(Request $request) : Response
}

/**
* @Route("/export/{type<groups|teams|scoreboard|results>}.tsv", name="jury_tsv_export")
* @Route("/export/{type<groups|teams|results>}.tsv", name="jury_tsv_export")
* @return RedirectResponse|StreamedResponse
* @throws Exception
*/
Expand All @@ -333,9 +333,6 @@ public function exportTsvAction(Request $request, string $type)
case 'teams':
$data = $this->importExportService->getTeamData();
break;
case 'scoreboard':
$data = $this->importExportService->getScoreboardData();
break;
case 'results':
$sortOrder = $request->query->getInt('sort_order');
$data = $this->importExportService->getResultsData($sortOrder);
Expand Down
54 changes: 0 additions & 54 deletions webapp/src/Service/ImportExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,60 +394,6 @@ public function getTeamData(): array
return $data;
}

/**
* Get scoreboard data
* @return array
* @throws Exception
*/
public function getScoreboardData(): array
{
// We'll here assume that the requested file will be of the current contest,
// as all our scoreboard interfaces do. Column format explanation:
// Col Description Example content Type
// 1 Institution name University of Virginia string
// 2 External ID 24314 integer
// 3 Position in contest 1 integer
// 4 Number of problems the team has solved 4 integer
// 5 Total Time 534 integer
// 6 Time of the last accepted submission 233 integer -1 if none
// 6+2i-1 Number of submissions for problem i 2 integer
// 6+2i Time when problem i was solved 233 integer -1 if not solved

$contest = $this->dj->getCurrentContest();
if ($contest === null) {
throw new BadRequestHttpException('No current contest');
}
$scoreIsInSeconds = (bool)$this->config->get('score_in_seconds');
$scoreboard = $this->scoreboardService->getScoreboard($contest, true);

$data = [];
foreach ($scoreboard->getScores() as $teamScore) {
$maxtime = -1;
$drow = [];
/** @var ScoreboardMatrixItem $matrixItem */
foreach ($scoreboard->getMatrix()[$teamScore->team->getTeamid()] as $matrixItem) {
$time = Utils::scoretime($matrixItem->time, $scoreIsInSeconds);
$drow[] = $matrixItem->numSubmissions;
$drow[] = $matrixItem->isCorrect ? $time : -1;
$maxtime = max($maxtime, $time);
}

$data[] = array_merge(
[
$teamScore->team->getAffiliation() ? $teamScore->team->getAffiliation()->getName() : '',
$teamScore->team->getIcpcid(),
$teamScore->rank,
$teamScore->numPoints,
$teamScore->totalTime,
$maxtime,
],
$drow
);
}

return $data;
}

/**
* Get results data for the given sortorder
* @param int $sortOrder
Expand Down
3 changes: 0 additions & 3 deletions webapp/templates/jury/import_export.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@
<div class="tile">
<h3>Export tab-separated</h3>
<ul>
<li>
<a href="{{ path('jury_tsv_export', {'type': 'scoreboard'}) }}"><code>scoreboard.tsv</code></a>
</li>
<li>
<code>results.tsv</code>:
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testIndexBasic() : void
self::assertSelectorExists('small:contains(\'Create a "Web Services Token"\')');

// We've reached the end of the page.
self::assertSelectorExists('li:contains("scoreboard.tsv")');
self::assertSelectorExists('li:contains("results.tsv")');
}

/**
Expand Down Expand Up @@ -207,10 +207,6 @@ public function provideTsvContents(): Generator
2 Self-Registered
3 Participants
4 Observers
'];
yield ['a:contains("scoreboard.tsv")', 'scoreboard 1
Utrecht University exteam 1 0 0 0 0 -1 0 -1 0 -1
1 0 0 0 0 -1 0 -1 0 -1
'];
}

Expand Down

0 comments on commit cfcc227

Please sign in to comment.