From 2501d27dce224f46027efe980ea277a566a916aa Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Thu, 21 Sep 2023 11:37:21 +0200 Subject: [PATCH] Storage for drawn-up/drawn-down --- .../src/main/kotlin/org/jeudego/pairgoth/model/Game.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt index 3d2f770..a4042d2 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt @@ -36,7 +36,8 @@ fun Game.toJson() = Json.Object( "w" to white, "b" to black, "h" to handicap, - "r" to "${result.symbol}" + "r" to "${result.symbol}", + "dd" to drawnUpDown ) fun Game.Companion.fromJson(json: Json.Object) = Game( @@ -44,5 +45,6 @@ fun Game.Companion.fromJson(json: Json.Object) = Game( white = json.getID("white") ?: throw Error("missing white player"), black = json.getID("black") ?: throw Error("missing black player"), handicap = json.getInt("handicap") ?: 0, - result = json.getChar("result")?.let { Game.Result.fromSymbol(it) } ?: UNKNOWN + result = json.getChar("result")?.let { Game.Result.fromSymbol(it) } ?: UNKNOWN, + drawnUpDown = json.getInt("drawnUpDown") ?: 0 )