diff --git a/webapp/src/Service/ScoreboardService.php b/webapp/src/Service/ScoreboardService.php index e1292937b5..f7f870dd95 100644 --- a/webapp/src/Service/ScoreboardService.php +++ b/webapp/src/Service/ScoreboardService.php @@ -554,7 +554,7 @@ public function updateRankCache(Contest $contest, Team $team): void } } - const SCALE = 9; + public const SCALE = 9; // Converts integer or bcmath floats to a string that can be used as a key in a score cache. // The resulting key will be a string with 33 characters, 23 before the decimal dot and 9 after. diff --git a/webapp/src/Utils/Scoreboard/Scoreboard.php b/webapp/src/Utils/Scoreboard/Scoreboard.php index b0e53fce1b..7773939f88 100644 --- a/webapp/src/Utils/Scoreboard/Scoreboard.php +++ b/webapp/src/Utils/Scoreboard/Scoreboard.php @@ -5,6 +5,7 @@ use App\Entity\Contest; use App\Entity\ContestProblem; use App\Entity\RankCache; +use App\Entity\ScoreboardType; use App\Entity\ScoreCache; use App\Entity\Team; use App\Entity\TeamCategory; @@ -152,22 +153,32 @@ protected function calculateScoreboard(): void !array_key_exists($probId, $this->problems)) { continue; } + $isCorrect = $scoreCell->getIsCorrect($this->restricted); $penalty = Utils::calcPenaltyTime( - $scoreCell->getIsCorrect($this->restricted), + $isCorrect, $scoreCell->getSubmissions($this->restricted), $this->penaltyTime, $this->scoreIsInSeconds ); + $contestProblem = $scoreCell->getContest()->getContestProblem($scoreCell->getProblem()); + // TODO: For actual scoring problems, we need to calculate the score here and + // output it with the correct precision. For now, this is always an integer. + $points = strval( + $isCorrect ? + $contestProblem->getPoints() : 0 + ); + $this->matrix[$teamId][$probId] = new ScoreboardMatrixItem( - isCorrect: $scoreCell->getIsCorrect($this->restricted), - isFirst: $scoreCell->getIsCorrect($this->restricted) && $scoreCell->getIsFirstToSolve(), + isCorrect: $isCorrect, + isFirst: $isCorrect && $scoreCell->getIsFirstToSolve(), numSubmissions: $scoreCell->getSubmissions($this->restricted), numSubmissionsPending: $scoreCell->getPending($this->restricted), time: $scoreCell->getSolveTime($this->restricted), penaltyTime: $penalty, runtime: $scoreCell->getRuntime($this->restricted), numSubmissionsInFreeze: $scoreCell->getPending(false), + points: $points, ); } @@ -257,6 +268,11 @@ public function showPoints(): bool return false; } + public function isScoring(): bool + { + return $this->contest->getScoreboardType() === ScoreboardType::SCORING; + } + /** * Return the used team categories for this scoreboard. * diff --git a/webapp/src/Utils/Scoreboard/ScoreboardMatrixItem.php b/webapp/src/Utils/Scoreboard/ScoreboardMatrixItem.php index d1df0cd422..2683d789e9 100644 --- a/webapp/src/Utils/Scoreboard/ScoreboardMatrixItem.php +++ b/webapp/src/Utils/Scoreboard/ScoreboardMatrixItem.php @@ -13,5 +13,6 @@ public function __construct( public int $penaltyTime, public int $runtime, public ?int $numSubmissionsInFreeze = null, + public string $points = "", ) {} } diff --git a/webapp/templates/partials/scoreboard_summary.html.twig b/webapp/templates/partials/scoreboard_summary.html.twig index 2ba3c08ebf..c5811b9436 100644 --- a/webapp/templates/partials/scoreboard_summary.html.twig +++ b/webapp/templates/partials/scoreboard_summary.html.twig @@ -23,7 +23,9 @@ {{ scoreboard.summary.numberOfPoints(sortOrder) }} {% endif %} -