diff --git a/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/ApiViewerState.kt b/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/ApiViewerState.kt new file mode 100644 index 000000000..49c52020c --- /dev/null +++ b/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/ApiViewerState.kt @@ -0,0 +1,46 @@ +package dev.dres.api.rest.types.evaluation + +import dev.dres.api.rest.types.evaluation.scores.ApiScore +import dev.dres.api.rest.types.evaluation.scores.ApiTeamGroupValue +import dev.dres.api.rest.types.evaluation.submission.ApiSubmission +import dev.dres.api.rest.types.template.team.ApiTeamGroup +import dev.dres.data.model.run.interfaces.EvaluationId +import dev.dres.data.model.run.interfaces.TaskId +import dev.dres.data.model.template.task.TaskTemplateId +import kotlinx.serialization.Serializable + +/** + * A DTO to transfer the initial state to the viewer. + * Contains all relevant information for the viewer to initiate itself. + */ +@Serializable +data class ApiViewerState( + /** The [EvaluationId] of the evaluation this state represents */ + val evaluationId: EvaluationId, + /** The name of the evaluation this state represents */ + val evaluationName: String, + /** The [ApiTeamInfo]s related to this evaluation */ + val teamInfos: List, + /** The [ApiTeamGroup]s of this evaluation */ + val teamGroups: List, + /** The [ApiTeamGroupValue]s associated with the [ApiTeamGroup]s */ + val teamGroupValue: List, + + /** The [ApiScore]s of the active task */ + val taskScores: List, + /** The [ApiScore]s, grouped for the entire evaluation */ + val evaluationScores: Map>, // ApiScoreOverview had taskGroup in it + + /** The [TaskId] of the current task. Could also only be selected task so far */ + val activeTaskId: TaskId, + /** The [TaskTemplateId] of the current task. */ + val activeTaskTemplateId: TaskTemplateId, + /** The time elapsed so far */ + val timeElapsed: Long, + /** The time remaining. Null means the task is perpetually running */ + val timeRemaining: Long?, // Prepare perpetual task + /** The [ApiTaskStatus] of the currently active task */ + val activeTaskStatus: ApiTaskStatus, + /** The [ApiSubmission]s related to the currently active task */ + val submissionsOverview: List +) diff --git a/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/scores/ApiScore.kt b/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/scores/ApiScore.kt index b86f5b451..03880a653 100644 --- a/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/scores/ApiScore.kt +++ b/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/scores/ApiScore.kt @@ -1,6 +1,7 @@ package dev.dres.api.rest.types.evaluation.scores import dev.dres.data.model.template.team.TeamId +import kotlinx.serialization.Serializable /** * A container class to track scores per team. @@ -8,4 +9,5 @@ import dev.dres.data.model.template.team.TeamId * @author Ralph Gasser * @version 1.0.0 */ -data class ApiScore(val teamId: TeamId, val score: Double) \ No newline at end of file +@Serializable +data class ApiScore(val teamId: TeamId, val score: Double) diff --git a/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/scores/ApiTeamGroupValue.kt b/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/scores/ApiTeamGroupValue.kt index fd163bbb0..4a0679480 100644 --- a/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/scores/ApiTeamGroupValue.kt +++ b/backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/scores/ApiTeamGroupValue.kt @@ -1,6 +1,9 @@ package dev.dres.api.rest.types.evaluation.scores +import kotlinx.serialization.Serializable + /** * */ +@Serializable data class ApiTeamGroupValue(val name: String, val value: Double)