Skip to content

Commit

Permalink
Show team badges instead of team ID's for balloon page.
Browse files Browse the repository at this point in the history
Also make locations unique for balloon page.
  • Loading branch information
Nicky Gerritsen committed Nov 25, 2023
1 parent acee3d2 commit bd87482
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
10 changes: 9 additions & 1 deletion webapp/src/Controller/API/BalloonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Controller\API;

use App\Entity\Contest;
use App\Entity\Team;
use App\Service\BalloonService;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\QueryBuilder;
Expand Down Expand Up @@ -52,7 +53,14 @@ public function listAction(
): array {
/** @var Contest $contest */
$contest = $this->em->getRepository(Contest::class)->find($this->getContestId($request));
return array_column($balloonService->collectBalloonTable($contest, $todo), 'data');
$balloonsData = $balloonService->collectBalloonTable($contest, $todo);
foreach ($balloonsData as &$b) {
/** @var Team $team */
$team = $b['data']['team'];
$b['data']['team'] = "t" . $team->getTeamid() . ": " . $team->getEffectiveName();
}
unset($b);
return array_column($balloonsData, 'data');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Controller/Jury/BalloonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function indexAction(BalloonService $balloonService): Response
if (isset($filters['location-str'])) {
/** @var Team[] $filteredLocations */
$filteredLocations = $this->em->createQueryBuilder()
->from(Team::class, 'a')
->from(Team::class, 'a', 'a.room')
->select('a')
->where('a.room IN (:rooms)')
->setParameter('rooms', $filters['location-str'])
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/Service/BalloonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function collectBalloonTable(Contest $contest, bool $todo = false): array

$query = $em->createQueryBuilder()
->select('b', 's.submittime', 'p.probid',
't.teamid', 't.name AS teamname', 't.room',
't.teamid', 's', 't', 't.room',
'c.categoryid AS categoryid', 'c.name AS catname',
'co.cid', 'co.shortname',
'cp.shortname AS probshortname', 'cp.color',
Expand Down Expand Up @@ -157,7 +157,7 @@ public function collectBalloonTable(Contest $contest, bool $todo = false): array
$balloondata['time'] = $stime;
$balloondata['problem'] = $balloonsData['probshortname'];
$balloondata['contestproblem'] = $balloon->getSubmission()->getContestProblem();
$balloondata['team'] = "t" . $balloonsData['teamid'] . ": " . $balloonsData['teamname'];
$balloondata['team'] = $balloon->getSubmission()->getTeam();
$balloondata['teamid'] = $balloonsData['teamid'];
$balloondata['location'] = $balloonsData['room'];
$balloondata['affiliation'] = $balloonsData['affilshort'];
Expand Down
5 changes: 4 additions & 1 deletion webapp/templates/jury/partials/balloon_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
<td>{{ balloon.data.balloonid }}</td>
<td data-order="{{ balloon.data.time }}">{{ balloon.data.time | printtime }}</td>
<td>{{ balloon.data.contestproblem | problemBadge }}</td>
<td>{{ balloon.data.team | u.truncate(teamname_max_length, '') }}</td>
<td>
{{ balloon.data.team | entityIdBadge('t') }}
{{ balloon.data.team.effectiveName | u.truncate(teamname_max_length, '') }}
</td>
<td>{{ balloon.data.affiliation }}</td>
<td>{{ balloon.data.location }}</td>
<td>{{ balloon.data.category }}</td>
Expand Down

0 comments on commit bd87482

Please sign in to comment.