update ocm tally
This commit is contained in:
parent
dbd0e8bfc8
commit
1c473e7211
@ -339,8 +339,8 @@ export default class GhostModule extends Module {
|
|||||||
{
|
{
|
||||||
// Pick random car Id
|
// Pick random car Id
|
||||||
let randomNumber: number = Math.floor(Math.random() * car.length);
|
let randomNumber: number = Math.floor(Math.random() * car.length);
|
||||||
if(arr.indexOf(randomNumber) === -1){
|
if(arr.indexOf(randomNumber) === -1)
|
||||||
|
{
|
||||||
// Push current number to array
|
// Push current number to array
|
||||||
arr.push(randomNumber);
|
arr.push(randomNumber);
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ export async function ocmTallying(body: wm.protobuf.LoadGhostCompetitionInfoRequ
|
|||||||
{
|
{
|
||||||
periodId = periodId - 1;
|
periodId = periodId - 1;
|
||||||
|
|
||||||
|
// Current day is main draw and tallying qualifying period
|
||||||
if(periodId === 0)
|
if(periodId === 0)
|
||||||
{
|
{
|
||||||
console.log('Tallying data from Qualifying');
|
console.log('Tallying data from Qualifying');
|
||||||
@ -28,12 +29,14 @@ export async function ocmTallying(body: wm.protobuf.LoadGhostCompetitionInfoRequ
|
|||||||
result: 'desc',
|
result: 'desc',
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
let arr = [];
|
||||||
|
|
||||||
// gbRecordTally is set
|
// gbRecordTally is set
|
||||||
if(gbRecordTally)
|
if(gbRecordTally)
|
||||||
{
|
{
|
||||||
let top1advantage = null;
|
let top1advantage = null;
|
||||||
let currentResult = 0;
|
let currentResult = 0;
|
||||||
|
|
||||||
for(let i=0; i<gbRecordTally.length; i++)
|
for(let i=0; i<gbRecordTally.length; i++)
|
||||||
{
|
{
|
||||||
// Get the Top 1 Advantage
|
// Get the Top 1 Advantage
|
||||||
@ -90,6 +93,9 @@ export async function ocmTallying(body: wm.protobuf.LoadGhostCompetitionInfoRequ
|
|||||||
currentResult = -Math.abs(currentResult);
|
currentResult = -Math.abs(currentResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pushing carId to array
|
||||||
|
arr.push(gbRecordTally[i].carId);
|
||||||
|
|
||||||
// Moving data to OCM Tally
|
// Moving data to OCM Tally
|
||||||
let data : any = {
|
let data : any = {
|
||||||
carId: gbRecordTally[i].carId,
|
carId: gbRecordTally[i].carId,
|
||||||
@ -113,9 +119,40 @@ export async function ocmTallying(body: wm.protobuf.LoadGhostCompetitionInfoRequ
|
|||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if someone is retiring or use cheat engine time up
|
||||||
|
let checkPlayRecord = await prisma.oCMPlayRecord.findMany({
|
||||||
|
where:{
|
||||||
|
NOT: {
|
||||||
|
carId:{ in: arr }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(checkPlayRecord)
|
||||||
|
{
|
||||||
|
for(let i=0; i<checkPlayRecord.length; i++)
|
||||||
|
{
|
||||||
|
// Moving data to OCM Tally
|
||||||
|
let dataLeft : any = {
|
||||||
|
carId: checkPlayRecord[i].carId,
|
||||||
|
result: -9999999,
|
||||||
|
tunePower: 17,
|
||||||
|
tuneHandling: 17,
|
||||||
|
competitionId: body.competitionId,
|
||||||
|
periodId: periodId + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the data
|
||||||
|
await prisma.oCMTally.create({
|
||||||
|
data: dataLeft
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Current day is main draw period 2 (and so on..) and tallying main draw period 1 (and so on..)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
console.log('Tallying data from previous Period');
|
console.log('Tallying data from previous Period');
|
||||||
|
Loading…
Reference in New Issue
Block a user