From 57decb9cbacf0be73d780bea75a3a157d72cce6f Mon Sep 17 00:00:00 2001 From: Luca Rossetto Date: Fri, 19 Jan 2024 15:34:24 +0100 Subject: [PATCH] Re-using ApiClientAnswer in result log --- .../dev/dres/data/model/log/ParticipantLog.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/backend/src/main/kotlin/dev/dres/data/model/log/ParticipantLog.kt b/backend/src/main/kotlin/dev/dres/data/model/log/ParticipantLog.kt index cfcbd27d..fb1154df 100644 --- a/backend/src/main/kotlin/dev/dres/data/model/log/ParticipantLog.kt +++ b/backend/src/main/kotlin/dev/dres/data/model/log/ParticipantLog.kt @@ -4,13 +4,16 @@ import com.fasterxml.jackson.annotation.JsonIgnore import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonSetter import com.fasterxml.jackson.annotation.Nulls +import dev.dres.api.rest.types.evaluation.submission.ApiClientAnswer import io.javalin.openapi.OpenApiIgnore +import kotlinx.serialization.Serializable enum class QueryEventCategory { TEXT, IMAGE, SKETCH, FILTER, BROWSING, COOPERATION, OTHER } @JsonIgnoreProperties(ignoreUnknown = true) +@Serializable data class QueryEvent( val timestamp: Long = -1, val category: QueryEventCategory = QueryEventCategory.OTHER, @@ -19,6 +22,7 @@ data class QueryEvent( ) @JsonIgnoreProperties(ignoreUnknown = true) +@Serializable data class QueryEventLog internal constructor( val timestamp: Long = -1, @field:JsonSetter(contentNulls = Nulls.FAIL) @@ -26,29 +30,30 @@ data class QueryEventLog internal constructor( @field:JsonIgnore @get:JsonIgnore @get:OpenApiIgnore + @kotlinx.serialization.Transient internal val serverTimeStamp: Long = System.currentTimeMillis() ) @JsonIgnoreProperties(ignoreUnknown = true) -data class QueryResult( - val item: String = "", - val segment: Int? = null, - val frame: Int? = null, - val score: Double? = null, +@Serializable +data class RankedAnswer( + val answer: ApiClientAnswer, val rank: Int? = null ) @JsonIgnoreProperties(ignoreUnknown = true) +@Serializable data class QueryResultLog internal constructor( val timestamp: Long = -1, val sortType: String = "", val resultSetAvailability: String = "", @field:JsonSetter(contentNulls = Nulls.FAIL) - val results: List = emptyList(), + val results: List = emptyList(), @field:JsonSetter(contentNulls = Nulls.FAIL) val events: List = emptyList(), @field:JsonIgnore @get:JsonIgnore @get:OpenApiIgnore + @kotlinx.serialization.Transient internal val serverTimeStamp: Long = System.currentTimeMillis() ) \ No newline at end of file