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

Fix highlighting of in-freeze submissions by introducing separate met… #2692

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 16 additions & 8 deletions webapp/src/Utils/Scoreboard/Scoreboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,14 @@ protected function calculateScoreboard(): void
);

$this->matrix[$teamId][$probId] = new ScoreboardMatrixItem(
$scoreRow->getIsCorrect($this->restricted),
$scoreRow->getIsCorrect($this->restricted) && $scoreRow->getIsFirstToSolve(),
$scoreRow->getSubmissions($this->restricted),
$scoreRow->getPending($this->restricted),
$scoreRow->getSolveTime($this->restricted),
$penalty,
$scoreRow->getRuntime($this->restricted)
isCorrect: $scoreRow->getIsCorrect($this->restricted),
isFirst: $scoreRow->getIsCorrect($this->restricted) && $scoreRow->getIsFirstToSolve(),
numSubmissions: $scoreRow->getSubmissions($this->restricted),
numSubmissionsPending: $scoreRow->getPending($this->restricted),
time: $scoreRow->getSolveTime($this->restricted),
penaltyTime: $penalty,
runtime: $scoreRow->getRuntime($this->restricted),
numSubmissionsInFreeze: $scoreRow->getPending(false),
);

if ($scoreRow->getIsCorrect($this->restricted)) {
Expand Down Expand Up @@ -216,7 +217,14 @@ protected function calculateScoreboard(): void
$problemId = $contestProblem->getProbid();
// Provide default scores when nothing submitted for this team + problem yet
if (!isset($this->matrix[$teamId][$problemId])) {
$this->matrix[$teamId][$problemId] = new ScoreboardMatrixItem(false, false, 0, 0, 0, 0, 0);
$this->matrix[$teamId][$problemId] = new ScoreboardMatrixItem(
isCorrect: false,
isFirst: false,
numSubmissions: 0,
numSubmissionsPending: 0,
time: 0,
penaltyTime: 0,
runtime: 0);
}

$problemMatrixItem = $this->matrix[$teamId][$problemId];
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/Utils/Scoreboard/ScoreboardMatrixItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public function __construct(
public int $numSubmissionsPending,
public float|string $time,
public int $penaltyTime,
public int $runtime
public int $runtime,
public ?int $numSubmissionsInFreeze = null,
) {}
}
25 changes: 16 additions & 9 deletions webapp/src/Utils/Scoreboard/SingleTeamScoreboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ protected function calculateScoreboard(): void
);

$this->matrix[$scoreRow->getTeam()->getTeamid()][$scoreRow->getProblem()->getProbid()] = new ScoreboardMatrixItem(
$scoreRow->getIsCorrect($this->restricted),
$scoreRow->getIsCorrect($this->showRestrictedFts) && $scoreRow->getIsFirstToSolve(),
// When public scoreboard is frozen, also show "x + y tries" for jury
$scoreRow->getSubmissions($this->freezeData->showFrozen() ? false : $this->restricted),
$scoreRow->getPending($this->freezeData->showFrozen() ? false : $this->restricted),
$scoreRow->getSolveTime($this->restricted),
$penalty,
$scoreRow->getRuntime($this->restricted)
isCorrect: $scoreRow->getIsCorrect($this->restricted),
isFirst: $scoreRow->getIsCorrect($this->showRestrictedFts) && $scoreRow->getIsFirstToSolve(),
numSubmissions: $scoreRow->getSubmissions($this->restricted),
numSubmissionsPending: $scoreRow->getPending($this->restricted),
time: $scoreRow->getSolveTime($this->restricted),
penaltyTime: $penalty,
runtime: $scoreRow->getRuntime($this->restricted),
numSubmissionsInFreeze: $scoreRow->getPending(false),
);
}

Expand All @@ -80,7 +80,14 @@ protected function calculateScoreboard(): void
$teamId = $this->team->getTeamid();
$problemId = $contestProblem->getProbid();
if (!isset($this->matrix[$teamId][$problemId])) {
$this->matrix[$teamId][$problemId] = new ScoreboardMatrixItem(false, false, 0, 0, 0, 0, 0);
$this->matrix[$teamId][$problemId] = new ScoreboardMatrixItem(
isCorrect: false,
isFirst: false,
numSubmissions: 0,
numSubmissionsPending: 0,
time: 0,
penaltyTime: 0,
runtime: 0);
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions webapp/templates/partials/scoreboard_table.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,8 @@
{% elseif matrixItem.numSubmissions > 0 %}
{% set scoreCssClass = 'score_incorrect' %}
{% endif %}
{% if jury and showPending and matrixItem.numSubmissionsPending > 0 %}
{% if scoreCssClass == 'score_pending' %}
{% set scoreCssClass = scoreCssClass ~ ' score_incorrect' %}
{% else %}
{% if jury and showPending and matrixItem.numSubmissionsInFreeze > 0 %}
{% if scoreCssClass != 'score_pending' %}
{% set scoreCssClass = scoreCssClass ~ ' score_pending' %}
{% endif %}
{% endif %}
Expand Down
Loading