Modification BDD stockage défi actif
This commit is contained in:
@ -58,17 +58,17 @@ export class GameService {
|
||||
throw new ConflictException("La partie n'a pas encore démarré.")
|
||||
|
||||
// Clôture de l'éventuel défi en cours, qui n'a alors pas été réussi
|
||||
await this.prisma.challengeAction.updateMany({
|
||||
where: {
|
||||
playerId: game.currentRun.runnerId,
|
||||
runId: game.currentRunId,
|
||||
active: true,
|
||||
},
|
||||
data: {
|
||||
active: false,
|
||||
success: false,
|
||||
},
|
||||
})
|
||||
const currentRunner = await this.prisma.player.findUnique({ where: { id: game.currentRun.runnerId } })
|
||||
if (currentRunner.activeChallengeId) {
|
||||
await this.prisma.challengeAction.update({
|
||||
where: { id: currentRunner.activeChallengeId },
|
||||
data: { success: false },
|
||||
})
|
||||
await this.prisma.player.update({
|
||||
where: { id: currentRunner.id },
|
||||
data: { activeChallengeId: null },
|
||||
})
|
||||
}
|
||||
|
||||
await this.prisma.playerRun.update({
|
||||
where: { id: game.currentRunId },
|
||||
@ -173,7 +173,7 @@ export class GameService {
|
||||
|
||||
const orpanChallengeMoneyUpdates = await this.prisma.moneyUpdate.findMany({ where: { reason: MoneyUpdateType.WIN_CHALLENGE, actionId: null } })
|
||||
await this.prisma.moneyUpdate.deleteMany({ where: { reason: MoneyUpdateType.WIN_CHALLENGE, actionId: null } })
|
||||
deleted.push(...orpanTrainMoneyUpdates)
|
||||
deleted.push(...orpanChallengeMoneyUpdates)
|
||||
|
||||
return { added: added, deleted: deleted }
|
||||
}
|
||||
|
Reference in New Issue
Block a user