Gestion des heures de fin des tentatives
This commit is contained in:
@ -37,7 +37,10 @@ export class GameService {
|
||||
})
|
||||
}
|
||||
else {
|
||||
run = game.currentRun
|
||||
run = await this.prisma.playerRun.update({
|
||||
where: { id: game.currentRunId },
|
||||
data: { end: null },
|
||||
})
|
||||
}
|
||||
return await this.prisma.game.update({
|
||||
where: { id: 1 },
|
||||
@ -66,6 +69,11 @@ export class GameService {
|
||||
},
|
||||
})
|
||||
|
||||
await this.prisma.playerRun.update({
|
||||
where: { id: game.currentRunId },
|
||||
data: { end: new Date() },
|
||||
})
|
||||
|
||||
const newRunnerId = game.currentRun.runnerId == 1 ? 2 : 1
|
||||
const firstRun = await this.prisma.playerRun.findFirst({ where: { runnerId: newRunnerId } }) !== null
|
||||
const newRun = await this.prisma.playerRun.create({
|
||||
@ -95,11 +103,13 @@ export class GameService {
|
||||
const game = await this.find()
|
||||
if (!game.started)
|
||||
throw new ConflictException("La partie n'a pas encore démarré.")
|
||||
await this.prisma.playerRun.update({
|
||||
where: { id: game.currentRunId },
|
||||
data: { end: new Date() },
|
||||
})
|
||||
return await this.prisma.game.update({
|
||||
where: { id: 1 },
|
||||
data: {
|
||||
started: false,
|
||||
},
|
||||
data: { started: false },
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user