Skip to content

Commit

Permalink
Started with a viewer state dto
Browse files Browse the repository at this point in the history
  • Loading branch information
sauterl committed Jun 17, 2024
1 parent 4b79f38 commit 8a51229
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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<ApiTeamInfo>,
/** The [ApiTeamGroup]s of this evaluation */
val teamGroups: List<ApiTeamGroup>,
/** The [ApiTeamGroupValue]s associated with the [ApiTeamGroup]s */
val teamGroupValue: List<ApiTeamGroupValue>,

/** The [ApiScore]s of the active task */
val taskScores: List<ApiScore>,
/** The [ApiScore]s, grouped for the entire evaluation */
val evaluationScores: Map<String, List<ApiScore>>, // 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<ApiSubmission>
)
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
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.
*
* @author Ralph Gasser
* @version 1.0.0
*/
data class ApiScore(val teamId: TeamId, val score: Double)
@Serializable
data class ApiScore(val teamId: TeamId, val score: Double)
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 8a51229

Please sign in to comment.