diff --git a/src/cds/core/src/main/kotlin/org/icpclive/cds/scoreboard/AbstractScoreboardCalculator.kt b/src/cds/core/src/main/kotlin/org/icpclive/cds/scoreboard/AbstractScoreboardCalculator.kt index 27723665a..efd13d624 100644 --- a/src/cds/core/src/main/kotlin/org/icpclive/cds/scoreboard/AbstractScoreboardCalculator.kt +++ b/src/cds/core/src/main/kotlin/org/icpclive/cds/scoreboard/AbstractScoreboardCalculator.kt @@ -186,6 +186,8 @@ public class ContestStateWithScoreboard internal constructor( public val lastSubmissionTime: Duration, ) +private fun RunInfo.isTested() = !isHidden && result !is RunResult.InProgress + public fun Flow.calculateScoreboard(optimismLevel: OptimismLevel): Flow = flow { var rows = persistentMapOf() var lastRanking = Ranking(emptyList(), emptyList(), emptyList()) @@ -211,13 +213,9 @@ public fun Flow.calculateScoreboard(optimismLevel: OptimismLevel) } lastSubmissionTime = maxOf(lastSubmissionTime, newRun.time) - val oldRunTested = oldRun != null && !oldRun.isHidden && oldRun.result !is RunResult.InProgress - val newRunTested = !newRun.isHidden && newRun.result !is RunResult.InProgress - if (!oldRunTested && !newRunTested) - emptyList() - else { - listOfNotNull(oldRun?.teamId, newRun.teamId).distinct() - } + listOfNotNull(oldRun?.teamId, newRun.teamId).distinct().takeIf { + oldRun == null || oldRun.isTested() || newRun.isTested() + } ?: emptyList() } } val teamsReallyAffected = teamsAffected.filter {