-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* start timeline * added problems letters * timeline * clean up * added websocket support * fix api * fix timeline design * add constants * ignore run after accepted verdict * delete RUNS_URL * refactor backend * ioi support * backend rework * design improvements * refactor * refactor * fix const * fix admin linter * fix api * some refactor * move to typescript
- Loading branch information
Showing
13 changed files
with
483 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/cds/core/src/main/kotlin/org/icpclive/cds/api/TimeLineRunInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.icpclive.cds.api | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import org.icpclive.cds.util.serializers.DurationInMillisecondsSerializer | ||
import kotlin.time.Duration | ||
|
||
@Serializable | ||
public sealed class TimeLineRunInfo { | ||
@Serializable | ||
@SerialName("ICPC") | ||
public data class ICPC( | ||
@Serializable(with = DurationInMillisecondsSerializer::class) val time: Duration, | ||
val problemId: ProblemId, | ||
val isAccepted: Boolean, | ||
val shortName: String) : TimeLineRunInfo() | ||
|
||
@Serializable | ||
@SerialName("IOI") | ||
public data class IOI(@Serializable(with = DurationInMillisecondsSerializer::class) val time: Duration, val problemId: ProblemId, val score: Double) : TimeLineRunInfo() | ||
|
||
@Serializable | ||
@SerialName("IN_PROGRESS") | ||
public data class InProgress(@Serializable(with = DurationInMillisecondsSerializer::class) val time: Duration, val problemId: ProblemId) : TimeLineRunInfo() | ||
|
||
public companion object { | ||
public fun fromRunInfo(info: RunInfo, acceptedProblems: MutableSet<ProblemId>): TimeLineRunInfo? { | ||
return when (info.result) { | ||
is RunResult.ICPC -> { | ||
val icpcResult = info.result | ||
if (!acceptedProblems.contains(info.problemId)) { | ||
if (icpcResult.verdict.isAccepted) { | ||
acceptedProblems.add(info.problemId) | ||
} | ||
ICPC(info.time, info.problemId, icpcResult.verdict.isAccepted, icpcResult.verdict.shortName) | ||
} else { | ||
null | ||
} | ||
} | ||
|
||
is RunResult.IOI -> { | ||
val ioiResult = info.result | ||
if (ioiResult.difference > 0) { | ||
IOI(info.time, info.problemId, ioiResult.scoreAfter) | ||
} else { | ||
null | ||
} | ||
} | ||
|
||
else -> { | ||
InProgress(info.time, info.problemId) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.