fix period id not found (hopefully)
This commit is contained in:
parent
9f25055d9e
commit
c93050092c
@ -26,7 +26,7 @@
|
|||||||
in rec {
|
in rec {
|
||||||
packages.bayshore = pkgs.buildNpmPackage {
|
packages.bayshore = pkgs.buildNpmPackage {
|
||||||
pname = "bayshore";
|
pname = "bayshore";
|
||||||
version = "1.1.0";
|
version = "1.1.1";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
npmDepsHash = "sha256-VbFdHmPF9we1MS8OibpJY51WKFUK3Iq9xNyb8GiBgL0=";
|
npmDepsHash = "sha256-VbFdHmPF9we1MS8OibpJY51WKFUK3Iq9xNyb8GiBgL0=";
|
||||||
|
|
||||||
|
@ -231,6 +231,27 @@ export async function saveOCMGhostHistory(body: wm.protobuf.SaveGameResultReques
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Period ID not found
|
||||||
|
if(!(OCM_periodId))
|
||||||
|
{
|
||||||
|
OCM_periodId = await prisma.oCMPeriod.findFirst({
|
||||||
|
where:{
|
||||||
|
competitionId: ocmEventDate!.competitionId,
|
||||||
|
startAt:
|
||||||
|
{
|
||||||
|
lte: date - ocmEventDate!.lengthOfInterval, // competitionStartAt is less than current date
|
||||||
|
},
|
||||||
|
closeAt:
|
||||||
|
{
|
||||||
|
gte: date - ocmEventDate!.lengthOfInterval, // competitionCloseAt is greater than current date
|
||||||
|
}
|
||||||
|
},
|
||||||
|
select:{
|
||||||
|
periodId: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let checkGhost = await prisma.oCMGhostBattleRecord.findFirst({
|
let checkGhost = await prisma.oCMGhostBattleRecord.findFirst({
|
||||||
where:{
|
where:{
|
||||||
carId: saveExGhostHistory.carId,
|
carId: saveExGhostHistory.carId,
|
||||||
@ -338,6 +359,27 @@ export async function saveOCMGhostHistory(body: wm.protobuf.SaveGameResultReques
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Period ID not found
|
||||||
|
if(!(OCM_periodId))
|
||||||
|
{
|
||||||
|
OCM_periodId = await prisma.oCMPeriod.findFirst({
|
||||||
|
where:{
|
||||||
|
competitionId: ocmEventDate!.competitionId,
|
||||||
|
startAt:
|
||||||
|
{
|
||||||
|
lte: date - ocmEventDate!.lengthOfInterval, // competitionStartAt is less than current date
|
||||||
|
},
|
||||||
|
closeAt:
|
||||||
|
{
|
||||||
|
gte: date - ocmEventDate!.lengthOfInterval, // competitionCloseAt is greater than current date
|
||||||
|
}
|
||||||
|
},
|
||||||
|
select:{
|
||||||
|
periodId: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Update ghost battle record
|
// Update ghost battle record
|
||||||
await prisma.oCMGhostBattleRecord.create({
|
await prisma.oCMGhostBattleRecord.create({
|
||||||
data: {
|
data: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user