diff --git a/prisma/migrations/20220825040457_challenger_history/migration.sql b/prisma/migrations/20220825040457_challenger_history/migration.sql new file mode 100644 index 0000000..65d5ce6 --- /dev/null +++ b/prisma/migrations/20220825040457_challenger_history/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0; + +-- AlterTable +ALTER TABLE "CarChallenger" ADD COLUMN "lastPlayedAt" INTEGER NOT NULL DEFAULT 0; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 03cb799..b14ead5 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -415,6 +415,7 @@ model CarChallenger { stamp Int result Int area Int + lastPlayedAt Int @default(0) } model CarStampTarget { diff --git a/src/modules/ghost.ts b/src/modules/ghost.ts index efe0005..f911623 100644 --- a/src/modules/ghost.ts +++ b/src/modules/ghost.ts @@ -33,27 +33,37 @@ export default class GhostModule extends Module { } }) - // ---For testing only--- - let cars = await prisma.car.findMany({ + // Car History + let findChallenger = await prisma.carChallenger.findMany({ where: { - OR: [ - { - name: { startsWith: 'KITSU' } + challengerCarId: body.carId + } + }) + + let carsHistory: wm.wm.protobuf.Car[] = []; + if(findChallenger.length > 0) + { + for(let i=0; i