mirror of
https://github.com/shiroikitsu8/Bayshore_6r_legacy.git
synced 2025-02-12 15:14:29 +01:00
TA records save really this time
This commit is contained in:
parent
0d194478dc
commit
cfe4e6798c
@ -58,32 +58,42 @@ export default class GameModule extends Module {
|
|||||||
if (currentRecord && body.taResult!.time > currentRecord.time)
|
if (currentRecord && body.taResult!.time > currentRecord.time)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
await prisma.timeAttackRecord.upsert({
|
if (!currentRecord) {
|
||||||
create: {
|
console.log('Creating new time attack record');
|
||||||
carId: body.carId,
|
await prisma.timeAttackRecord.create({
|
||||||
model: body.car!.model!,
|
data: {
|
||||||
section1Time: body!.taResult!.section_1Time,
|
carId: body.carId,
|
||||||
section2Time: body!.taResult!.section_2Time,
|
model: body.car!.model!,
|
||||||
section3Time: body!.taResult!.section_3Time,
|
time: body.taResult!.time,
|
||||||
section4Time: body!.taResult!.section_4Time,
|
isMorning: body.taResult!.isMorning,
|
||||||
section5Time: body!.taResult!.section_5Time,
|
course: body.taResult!.course,
|
||||||
section6Time: body!.taResult!.section_6Time,
|
section1Time: body!.taResult!.section_1Time,
|
||||||
section7Time: body!.taResult!.section_7Time,
|
section2Time: body!.taResult!.section_2Time,
|
||||||
...body!.taResult!
|
section3Time: body!.taResult!.section_3Time,
|
||||||
},
|
section4Time: body!.taResult!.section_4Time,
|
||||||
update: {
|
section5Time: body!.taResult!.section_5Time,
|
||||||
section1Time: body!.taResult!.section_1Time,
|
section6Time: body!.taResult!.section_6Time,
|
||||||
section2Time: body!.taResult!.section_2Time,
|
section7Time: body!.taResult!.section_7Time,
|
||||||
section3Time: body!.taResult!.section_3Time,
|
}
|
||||||
section4Time: body!.taResult!.section_4Time,
|
});
|
||||||
section5Time: body!.taResult!.section_5Time,
|
break;
|
||||||
section6Time: body!.taResult!.section_6Time,
|
}
|
||||||
section7Time: body!.taResult!.section_7Time,
|
|
||||||
...body!.taResult!
|
console.log('Updating time attack record...')
|
||||||
},
|
await prisma.timeAttackRecord.update({
|
||||||
where: {
|
where: {
|
||||||
// Could be null - if it is null, this will insert.
|
// Could be null - if it is null, this will insert.
|
||||||
dbId: currentRecord?.dbId
|
dbId: currentRecord!.dbId
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
time: body.taResult!.time,
|
||||||
|
section1Time: body!.taResult!.section_1Time,
|
||||||
|
section2Time: body!.taResult!.section_2Time,
|
||||||
|
section3Time: body!.taResult!.section_3Time,
|
||||||
|
section4Time: body!.taResult!.section_4Time,
|
||||||
|
section5Time: body!.taResult!.section_5Time,
|
||||||
|
section6Time: body!.taResult!.section_6Time,
|
||||||
|
section7Time: body!.taResult!.section_7Time,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user