Search matching table when entering results in Toulouse24 test

This commit is contained in:
Quentin Rendu
2024-05-28 10:49:17 +02:00
parent 134c4fa234
commit 3a03b7100a

View File

@@ -501,9 +501,17 @@ class PairingTests: TestBase() {
firstGameID = (games.getJson(0)!!.asObject()["id"] as Long?)!!.toInt() firstGameID = (games.getJson(0)!!.asObject()["id"] as Long?)!!.toInt()
for (i in 0 until games.size) { for (i in 0 until games.size) {
val gameID = firstGameID + i val gameID = firstGameID + i
val gameRes = pairingsOG[round-1].getJson(i)!!.asObject()["r"] as String? // find corresponding game (matching white id)
for (j in 0 until games.size) {
val gameOG = pairingsOG[round-1].getJson(j)!!.asObject()// ["r"] as String?
if (gameOG["w"] == games.getJson(i)!!.asObject()["w"]){
val gameRes = gameOG["r"] as String?
resp = TestAPI.put("/api/tour/$id/res/$round", Json.parse("""{"id":$gameID,"result":"$gameRes"}""")).asObject() resp = TestAPI.put("/api/tour/$id/res/$round", Json.parse("""{"id":$gameID,"result":"$gameRes"}""")).asObject()
assertTrue(resp.getBoolean("success") == true, "expecting success") assertTrue(resp.getBoolean("success") == true, "expecting success")
break
}
}
} }
logger.info("Results succesfully entered for round $round") logger.info("Results succesfully entered for round $round")
} }