From 61bff55b4e706ceb9a519044fc67b37c8ea020d2 Mon Sep 17 00:00:00 2001 From: Bhoopesh Date: Fri, 26 Jan 2024 14:40:13 +0530 Subject: [PATCH] fix: pvp response --- docs/spec/CodeCharacter-API.yml | 20 ++---- .../delta/codecharacter/core/MatchApi.kt | 9 ++- .../delta/codecharacter/dtos/PvPGameDto.kt | 16 ++--- .../server/logic/verdict/VerdictAlgorithm.kt | 7 ++ .../server/logic/verdict/WinnerAlgorithm.kt | 15 ++++ .../server/match/MatchController.kt | 4 +- .../server/match/MatchService.kt | 48 +++++-------- .../server/pvp_game/PvPGameEntity.kt | 6 +- .../server/pvp_game/PvPGameService.kt | 21 +++--- .../queue/entities/PvPGameResultEntity.kt | 3 +- .../server/match/RabbitIntegrationTest.kt | 2 + .../PvPGameControllerIntegrationTest.kt | 6 +- .../server/pvp_game/PvPGameServiceTest.kt | 71 ++++++++++++++----- 13 files changed, 128 insertions(+), 100 deletions(-) diff --git a/docs/spec/CodeCharacter-API.yml b/docs/spec/CodeCharacter-API.yml index db5e2d7..3b54fa7 100644 --- a/docs/spec/CodeCharacter-API.yml +++ b/docs/spec/CodeCharacter-API.yml @@ -318,7 +318,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/Match' + type: object examples: Example: value: @@ -989,7 +989,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/Match' + type: object examples: Example: value: @@ -1986,26 +1986,18 @@ components: type: string format: uuid example: 123e4567-e89b-12d3-a456-426614174000 - destructionPlayer1: - type: number - example: 100 - destructionPlayer2: - type: number - example: 100 - coinsUsedPlayer1: + scorePlayer1: type: integer example: 69 - coinsUsedPlayer2: + scorePlayer2: type: integer example: 69 status: $ref: '#/components/schemas/PvPGameStatus' required: - id - - destructionPlayer1 - - destructionPlayer2 - - coinsUsedPlayer1 - - coinsUsedPlayer2 + - scorePlayer1 + - scorePlayer2 - status PvPGameLog: type: string diff --git a/library/src/main/kotlin/delta/codecharacter/core/MatchApi.kt b/library/src/main/kotlin/delta/codecharacter/core/MatchApi.kt index 88ccea9..80255bf 100644 --- a/library/src/main/kotlin/delta/codecharacter/core/MatchApi.kt +++ b/library/src/main/kotlin/delta/codecharacter/core/MatchApi.kt @@ -7,7 +7,6 @@ package delta.codecharacter.core import delta.codecharacter.dtos.CreateMatchRequestDto import delta.codecharacter.dtos.GenericErrorDto -import delta.codecharacter.dtos.MatchDto import io.swagger.v3.oas.annotations.* import io.swagger.v3.oas.annotations.enums.* import io.swagger.v3.oas.annotations.media.* @@ -65,7 +64,7 @@ interface MatchApi { operationId = "getTopMatches", description = """Get top matches""", responses = [ - ApiResponse(responseCode = "200", description = "OK", content = [Content(array = ArraySchema(schema = Schema(implementation = MatchDto::class)))]), + ApiResponse(responseCode = "200", description = "OK", content = [Content(array = ArraySchema(schema = Schema(implementation = kotlin.Any::class)))]), ApiResponse(responseCode = "401", description = "Unauthorized") ], security = [ SecurityRequirement(name = "http-bearer") ] @@ -75,7 +74,7 @@ interface MatchApi { value = ["/top-matches"], produces = ["application/json"] ) - fun getTopMatches(): ResponseEntity> { + fun getTopMatches(): ResponseEntity> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @@ -84,7 +83,7 @@ interface MatchApi { operationId = "getUserMatches", description = """Get matches played by authenticated user""", responses = [ - ApiResponse(responseCode = "200", description = "OK", content = [Content(array = ArraySchema(schema = Schema(implementation = MatchDto::class)))]), + ApiResponse(responseCode = "200", description = "OK", content = [Content(array = ArraySchema(schema = Schema(implementation = kotlin.Any::class)))]), ApiResponse(responseCode = "401", description = "Unauthorized") ], security = [ SecurityRequirement(name = "http-bearer") ] @@ -94,7 +93,7 @@ interface MatchApi { value = ["/user/matches"], produces = ["application/json"] ) - fun getUserMatches(): ResponseEntity> { + fun getUserMatches(): ResponseEntity> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } } diff --git a/library/src/main/kotlin/delta/codecharacter/dtos/PvPGameDto.kt b/library/src/main/kotlin/delta/codecharacter/dtos/PvPGameDto.kt index fe60589..3d526e8 100644 --- a/library/src/main/kotlin/delta/codecharacter/dtos/PvPGameDto.kt +++ b/library/src/main/kotlin/delta/codecharacter/dtos/PvPGameDto.kt @@ -18,10 +18,8 @@ import io.swagger.v3.oas.annotations.media.Schema /** * PvP Game model * @param id - * @param destructionPlayer1 - * @param destructionPlayer2 - * @param coinsUsedPlayer1 - * @param coinsUsedPlayer2 + * @param scorePlayer1 + * @param scorePlayer2 * @param status */ data class PvPGameDto( @@ -29,17 +27,11 @@ data class PvPGameDto( @Schema(example = "123e4567-e89b-12d3-a456-426614174000", required = true, description = "") @get:JsonProperty("id", required = true) val id: java.util.UUID, - @Schema(example = "100", required = true, description = "") - @get:JsonProperty("destructionPlayer1", required = true) val destructionPlayer1: java.math.BigDecimal, - - @Schema(example = "100", required = true, description = "") - @get:JsonProperty("destructionPlayer2", required = true) val destructionPlayer2: java.math.BigDecimal, - @Schema(example = "69", required = true, description = "") - @get:JsonProperty("coinsUsedPlayer1", required = true) val coinsUsedPlayer1: kotlin.Int, + @get:JsonProperty("scorePlayer1", required = true) val scorePlayer1: kotlin.Int, @Schema(example = "69", required = true, description = "") - @get:JsonProperty("coinsUsedPlayer2", required = true) val coinsUsedPlayer2: kotlin.Int, + @get:JsonProperty("scorePlayer2", required = true) val scorePlayer2: kotlin.Int, @field:Valid @Schema(example = "null", required = true, description = "") diff --git a/server/src/main/kotlin/delta/codecharacter/server/logic/verdict/VerdictAlgorithm.kt b/server/src/main/kotlin/delta/codecharacter/server/logic/verdict/VerdictAlgorithm.kt index 80c3afe..0eace17 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/logic/verdict/VerdictAlgorithm.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/logic/verdict/VerdictAlgorithm.kt @@ -11,4 +11,11 @@ interface VerdictAlgorithm { player2CoinsUsed: Int, player2Destruction: Double ): MatchVerdictEnum + + fun getPvPVerdict( + player1HasErrors: Boolean, + player1Score: Int, + player2HasErrors: Boolean, + player2Score: Int, + ) : MatchVerdictEnum } diff --git a/server/src/main/kotlin/delta/codecharacter/server/logic/verdict/WinnerAlgorithm.kt b/server/src/main/kotlin/delta/codecharacter/server/logic/verdict/WinnerAlgorithm.kt index 542c364..e3dc4d1 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/logic/verdict/WinnerAlgorithm.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/logic/verdict/WinnerAlgorithm.kt @@ -36,4 +36,19 @@ class WinnerAlgorithm : VerdictAlgorithm { if (player1Score > player2Score) return MatchVerdictEnum.PLAYER1 return MatchVerdictEnum.PLAYER2 } + + override fun getPvPVerdict( + player1HasErrors: Boolean, + player1Score: Int, + player2HasErrors: Boolean, + player2Score: Int + ): MatchVerdictEnum { + if (player1HasErrors && player2HasErrors) return MatchVerdictEnum.TIE + if (player1HasErrors) return MatchVerdictEnum.PLAYER2 + if (player2HasErrors) return MatchVerdictEnum.PLAYER1 + + if (player1Score == player2Score) return MatchVerdictEnum.TIE + if (player1Score > player2Score) return MatchVerdictEnum.PLAYER1 + return MatchVerdictEnum.PLAYER2 + } } diff --git a/server/src/main/kotlin/delta/codecharacter/server/match/MatchController.kt b/server/src/main/kotlin/delta/codecharacter/server/match/MatchController.kt index c7c5c51..4d6e7ee 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/match/MatchController.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/match/MatchController.kt @@ -27,12 +27,12 @@ class MatchController(@Autowired private val matchService: MatchService) : Match } @Secured("ROLE_USER") - override fun getTopMatches(): ResponseEntity> { + override fun getTopMatches(): ResponseEntity> { return ResponseEntity.ok(matchService.getTopMatches()) } @Secured("ROLE_USER") - override fun getUserMatches(): ResponseEntity> { + override fun getUserMatches(): ResponseEntity> { val user = SecurityContextHolder.getContext().authentication.principal as UserEntity return ResponseEntity.ok(matchService.getUserMatches(user.id)) } diff --git a/server/src/main/kotlin/delta/codecharacter/server/match/MatchService.kt b/server/src/main/kotlin/delta/codecharacter/server/match/MatchService.kt index 4addce0..6152bd6 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/match/MatchService.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/match/MatchService.kt @@ -319,28 +319,20 @@ class MatchService( } } - private fun mapPvPMatchEntitiesToDtos(pvPMatchEntities: List): List { + private fun mapPvPMatchEntitiesToDtos(pvPMatchEntities: List): List { return pvPMatchEntities.map { pvPMatchEntity -> - MatchDto( + PvPMatchDto( id = pvPMatchEntity.id, matchMode = MatchModeDto.valueOf(pvPMatchEntity.mode.name), matchVerdict = VerdictDto.valueOf(pvPMatchEntity.verdict.name), createdAt = pvPMatchEntity.createdAt, - games = - setOf( - GameDto ( + game = + PvPGameDto ( id = pvPMatchEntity.game.matchId, - destruction = BigDecimal(pvPMatchEntity.game.destructionPlayer1), - coinsUsed = pvPMatchEntity.game.coinsUsedPlayer1, - status = GameStatusDto.valueOf(pvPMatchEntity.game.status.name) - ), - GameDto ( - id = pvPMatchEntity.game.matchId, - destruction = BigDecimal(pvPMatchEntity.game.destructionPlayer2), - coinsUsed = pvPMatchEntity.game.coinsUsedPlayer2, - status = GameStatusDto.valueOf(pvPMatchEntity.game.status.name) - ) - ), + scorePlayer1 = pvPMatchEntity.game.scorePlayer1, + scorePlayer2 = pvPMatchEntity.game.scorePlayer2, + status = PvPGameStatusDto.valueOf(pvPMatchEntity.game.status.name), + ), user1 = PublicUserDto( username = pvPMatchEntity.player1.username, @@ -394,13 +386,13 @@ class MatchService( } } - fun getTopMatches(): List { + fun getTopMatches(): List { val matches = matchRepository.findTop10ByOrderByTotalPointsDesc() val pvPMatches = pvPMatchRepository.findTop10ByOrderByTotalPointsDesc() - return mapMatchEntitiesToDtos(matches) + mapPvPMatchEntitiesToDtos(pvPMatches) + return listOf(mapMatchEntitiesToDtos(matches) + mapPvPMatchEntitiesToDtos(pvPMatches)) } - fun getUserMatches(userId: UUID): List { + fun getUserMatches(userId: UUID): List { val publicUser = publicUserService.getPublicUser(userId) val matches = matchRepository.findByPlayer1OrderByCreatedAtDesc(publicUser) val pvPMatches = pvPMatchRepository.findByPlayer1OrderByCreatedAtDesc(publicUser) @@ -418,7 +410,7 @@ class MatchService( mapper.readValue(gameStatusUpdateJson, GameStatusUpdateEntity::class.java) val gameId = gameStatusUpdateEntity.gameId - var matchId: UUID + val matchId: UUID if(gameRepository.findById(gameId).isPresent) { val game = gameRepository.findById(gameId).get() matchId = game.matchId // for normal matches, each match has 2 games @@ -600,24 +592,22 @@ class MatchService( simpMessagingTemplate.convertAndSend( "/updates/${match.player1.userId}", mapper.writeValueAsString( - GameDto( + PvPGameDto( id = updatedGame.matchId, - destruction = BigDecimal(updatedGame.destructionPlayer1), - coinsUsed = updatedGame.coinsUsedPlayer1, - status = GameStatusDto.valueOf(updatedGame.status.name), + scorePlayer1 = updatedGame.scorePlayer1, + scorePlayer2 = updatedGame.scorePlayer2, + status = PvPGameStatusDto.valueOf(updatedGame.status.name), ) ) ) } if (match.game.status == PvPGameStatusEnum.EXECUTED) { val verdict = - verdictAlgorithm.getVerdict( + verdictAlgorithm.getPvPVerdict( match.game.status == PvPGameStatusEnum.EXECUTE_ERROR, - match.game.coinsUsedPlayer1, - match.game.destructionPlayer1, + match.game.scorePlayer1, match.game.status == PvPGameStatusEnum.EXECUTE_ERROR, - match.game.coinsUsedPlayer2, - match.game.destructionPlayer2 + match.game.scorePlayer2, ) val finishedMatch = match.copy(verdict = verdict) val (newUserRating, newOpponentRating) = diff --git a/server/src/main/kotlin/delta/codecharacter/server/pvp_game/PvPGameEntity.kt b/server/src/main/kotlin/delta/codecharacter/server/pvp_game/PvPGameEntity.kt index ad442f7..cb04596 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/pvp_game/PvPGameEntity.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/pvp_game/PvPGameEntity.kt @@ -7,9 +7,7 @@ import java.util.UUID @Document(collection = "pvp_game") data class PvPGameEntity ( @Id val matchId: UUID, - var destructionPlayer1: Double, - var destructionPlayer2: Double, - var coinsUsedPlayer1: Int, - var coinsUsedPlayer2: Int, + var scorePlayer1: Int, + var scorePlayer2: Int, var status: PvPGameStatusEnum ) diff --git a/server/src/main/kotlin/delta/codecharacter/server/pvp_game/PvPGameService.kt b/server/src/main/kotlin/delta/codecharacter/server/pvp_game/PvPGameService.kt index fa2aeae..de95f6b 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/pvp_game/PvPGameService.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/pvp_game/PvPGameService.kt @@ -33,10 +33,8 @@ class PvPGameService( val pvPGame = PvPGameEntity( matchId = matchId, - destructionPlayer1 = 0.0, - destructionPlayer2 = 0.0, - coinsUsedPlayer1 = 0, - coinsUsedPlayer2 = 0, + scorePlayer1 = 0, + scorePlayer2 = 0, status = PvPGameStatusEnum.IDLE, ) return pvPGameRepository.save(pvPGame) @@ -63,15 +61,16 @@ class PvPGameService( if(gameStatusUpdateEntity.gameResultPlayer1 == null || gameStatusUpdateEntity.gameResultPlayer2 == null) { val newPvPGameEntity = oldPvPGameEntity.copy(status = gameStatusUpdateEntity.gameStatus) println("newPvPGameEntity: $newPvPGameEntity") - return pvPGameRepository.save(newPvPGameEntity) + println("type of newPvPGameEntity: ${newPvPGameEntity::class.java}") + println("pvPGame: ${pvPGameRepository.save(newPvPGameEntity)}") + println("type of pvPGame: ${pvPGameRepository.save(newPvPGameEntity)::class.java}") + //val pvPGame = pvPGameRepository.save(newPvPGameEntity) + return oldPvPGameEntity } val gameResultPlayer1 = gameStatusUpdateEntity.gameResultPlayer1 val gameResultPlayer2 = gameStatusUpdateEntity.gameResultPlayer2 - val (destructionPercentagePlayer1, coinsUsedPlayer1) = gameResultPlayer1 - val (destructionPercentagePlayer2, coinsUsedPlayer2) = gameResultPlayer2 - val gameStatus = if (gameResultPlayer1.hasErrors || gameResultPlayer2.hasErrors) { PvPGameStatusEnum.EXECUTE_ERROR @@ -81,10 +80,8 @@ class PvPGameService( val newPvPGameEntity = oldPvPGameEntity.copy( - destructionPlayer1 = destructionPercentagePlayer1, - coinsUsedPlayer1 = coinsUsedPlayer1, - destructionPlayer2 = destructionPercentagePlayer2, - coinsUsedPlayer2 = coinsUsedPlayer2, + scorePlayer1 = gameResultPlayer1.score, + scorePlayer2 = gameResultPlayer2.score, status = gameStatus ) diff --git a/server/src/main/kotlin/delta/codecharacter/server/pvp_game/queue/entities/PvPGameResultEntity.kt b/server/src/main/kotlin/delta/codecharacter/server/pvp_game/queue/entities/PvPGameResultEntity.kt index 30fbf4b..935c3c0 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/pvp_game/queue/entities/PvPGameResultEntity.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/pvp_game/queue/entities/PvPGameResultEntity.kt @@ -3,8 +3,7 @@ package delta.codecharacter.server.pvp_game.queue.entities import com.fasterxml.jackson.annotation.JsonProperty data class PvPGameResultEntity ( - @field:JsonProperty("destruction_percentage", required = true) val destructionPercentage: Double, - @field:JsonProperty("coins_used", required = true) val coinsUsed: Int, + @field:JsonProperty("score", required = true) val score: Int, @field:JsonProperty("has_errors", required = true) val hasErrors: Boolean, @field:JsonProperty("log", required = true) val log: String, ) diff --git a/server/src/test/kotlin/delta/codecharacter/server/match/RabbitIntegrationTest.kt b/server/src/test/kotlin/delta/codecharacter/server/match/RabbitIntegrationTest.kt index 438ae89..8fc9e13 100644 --- a/server/src/test/kotlin/delta/codecharacter/server/match/RabbitIntegrationTest.kt +++ b/server/src/test/kotlin/delta/codecharacter/server/match/RabbitIntegrationTest.kt @@ -68,6 +68,7 @@ internal class RabbitIntegrationTest(@Autowired val mockMvc: MockMvc) { mongoTemplate.save(TestAttributes.publicUser) try { rabbitAdmin.purgeQueue("gameRequestQueue", true) + rabbitAdmin.purgeQueue("gamePvPRequestQueue", true) rabbitAdmin.purgeQueue("gameStatusUpdateQueue", true) } catch (e: Exception) { println("RabbitMQ queues are not available") @@ -370,6 +371,7 @@ internal class RabbitIntegrationTest(@Autowired val mockMvc: MockMvc) { try { rabbitAdmin.purgeQueue("gameRequestQueue", true) + rabbitAdmin.purgeQueue("gamePvPRequestQueue", true) rabbitAdmin.purgeQueue("gameStatusUpdateQueue", true) } catch (e: Exception) { println("RabbitMQ queues are not available") diff --git a/server/src/test/kotlin/delta/codecharacter/server/pvp_game/PvPGameControllerIntegrationTest.kt b/server/src/test/kotlin/delta/codecharacter/server/pvp_game/PvPGameControllerIntegrationTest.kt index c78b8f6..f2b4a28 100644 --- a/server/src/test/kotlin/delta/codecharacter/server/pvp_game/PvPGameControllerIntegrationTest.kt +++ b/server/src/test/kotlin/delta/codecharacter/server/pvp_game/PvPGameControllerIntegrationTest.kt @@ -61,10 +61,8 @@ internal class PvPGameControllerIntegrationTest(@Autowired val mockMvc: MockMvc) val pvPGameEntity = PvPGameEntity( matchId = UUID.randomUUID(), - destructionPlayer1 = 100.0, - destructionPlayer2 = 100.0, - coinsUsedPlayer1 = 100, - coinsUsedPlayer2 = 100, + scorePlayer1 = 0, + scorePlayer2 = 0, status = PvPGameStatusEnum.EXECUTED, ) mongoTemplate.save(pvPGameEntity) diff --git a/server/src/test/kotlin/delta/codecharacter/server/pvp_game/PvPGameServiceTest.kt b/server/src/test/kotlin/delta/codecharacter/server/pvp_game/PvPGameServiceTest.kt index 2de6e8b..19be3bf 100644 --- a/server/src/test/kotlin/delta/codecharacter/server/pvp_game/PvPGameServiceTest.kt +++ b/server/src/test/kotlin/delta/codecharacter/server/pvp_game/PvPGameServiceTest.kt @@ -107,15 +107,60 @@ internal class PvPGameServiceTest { confirmVerified(rabbitTemplate) } + @Test + fun `should receive pvp game status update`() { + val pvPGame = + PvPGameEntity( + matchId = UUID.randomUUID(), + scorePlayer1 = 0, + scorePlayer2 = 0, + status = PvPGameStatusEnum.IDLE, + ) + + val pvPGameStatusUpdate = + PvPGameStatusUpdateEntity( + gameId = pvPGame.matchId, + gameStatus = PvPGameStatusEnum.EXECUTING, + gameResultPlayer1 = null, + gameResultPlayer2 = null + ) + + + every { pvPGameRepository.findById(pvPGame.matchId) } returns Optional.of(pvPGame) + every { + pvPGameRepository.save( + PvPGameEntity( + pvPGame.matchId, + pvPGame.scorePlayer1, + pvPGame.scorePlayer2, + PvPGameStatusEnum.EXECUTING, + ) + ) + } returns mockk() + + pvPGameService.updateGameStatus(mapper.writeValueAsString(pvPGameStatusUpdate)) + + verify { pvPGameRepository.findById(pvPGame.matchId) } + verify { + pvPGameRepository.save( + PvPGameEntity( + pvPGame.matchId, + pvPGame.scorePlayer1, + pvPGame.scorePlayer2, + PvPGameStatusEnum.EXECUTING, + ) + ) + } + confirmVerified(pvPGameRepository) + } + @Test fun `should receive pvp game status update with result`() { val pvPGame = PvPGameEntity( matchId = UUID.randomUUID(), - destructionPlayer1 = 100.0, - destructionPlayer2 = 100.0, - coinsUsedPlayer1 = 100, - coinsUsedPlayer2 = 100, + scorePlayer1 = 0, + scorePlayer2 = 0, status = PvPGameStatusEnum.IDLE, ) val pvPGameStatusUpdate = @@ -124,15 +169,13 @@ internal class PvPGameServiceTest { gameStatus = PvPGameStatusEnum.EXECUTED, gameResultPlayer1 = PvPGameResultEntity( - coinsUsed = 0, - destructionPercentage = 0.0, + score = 100, hasErrors = false, log = "player1 log" ), gameResultPlayer2 = PvPGameResultEntity( - coinsUsed = 0, - destructionPercentage = 0.0, + score = 100, hasErrors = false, log = "player2 log" ), @@ -141,10 +184,8 @@ internal class PvPGameServiceTest { val updatedPvPGameEntity = PvPGameEntity( matchId = pvPGame.matchId, - destructionPlayer1 = pvPGameStatusUpdate.gameResultPlayer1!!.destructionPercentage, - destructionPlayer2 = pvPGameStatusUpdate.gameResultPlayer2!!.destructionPercentage, - coinsUsedPlayer1 = pvPGameStatusUpdate.gameResultPlayer1!!.coinsUsed, - coinsUsedPlayer2 = pvPGameStatusUpdate.gameResultPlayer2!!.coinsUsed, + scorePlayer1 = pvPGameStatusUpdate.gameResultPlayer1!!.score, + scorePlayer2 = pvPGameStatusUpdate.gameResultPlayer2!!.score, status = pvPGameStatusUpdate.gameStatus, ) @@ -158,10 +199,8 @@ internal class PvPGameServiceTest { pvPGameRepository.save( PvPGameEntity ( matchId = pvPGame.matchId, - destructionPlayer1 = pvPGameStatusUpdate.gameResultPlayer1!!.destructionPercentage, - destructionPlayer2 = pvPGameStatusUpdate.gameResultPlayer2!!.destructionPercentage, - coinsUsedPlayer1 = pvPGameStatusUpdate.gameResultPlayer1!!.coinsUsed, - coinsUsedPlayer2 = pvPGameStatusUpdate.gameResultPlayer2!!.coinsUsed, + scorePlayer1 = pvPGameStatusUpdate.gameResultPlayer1!!.score, + scorePlayer2 = pvPGameStatusUpdate.gameResultPlayer2!!.score, status = pvPGameStatusUpdate.gameStatus, ) )