From 3d0060dec961796e4640d2de4e68ec6f6564d28a Mon Sep 17 00:00:00 2001 From: Ronnie Friman <L4168@student.jamk.fi> Date: Thu, 18 Jul 2019 19:52:41 +0300 Subject: [PATCH] moved mockdata scoreticks --- src/replay/replay.service.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/replay/replay.service.ts b/src/replay/replay.service.ts index 3120ecd..04ace74 100644 --- a/src/replay/replay.service.ts +++ b/src/replay/replay.service.ts @@ -57,7 +57,7 @@ export class ReplayService { async replayData(gameId) { // - // this block returs all player data from the game + // this block returns all player data from the game // let playerdata = await this.trackingRepository.find({ where: { game: gameId }, @@ -78,7 +78,7 @@ export class ReplayService { }), ); // - // this block return all faction data from the game + // this block returns all faction data from the game // let factions = await this.factionRepository.find({ game: gameId }); let currentFactions = factions.map(faction => { @@ -111,7 +111,6 @@ export class ReplayService { ); }), ); - console.log(currentScore); return { players: currentdata, @@ -137,6 +136,7 @@ export class ReplayService { const LAT = 62.24147; const LNG = 25.72088; // set the score tick amount + // not used at the moment const SCORE_TICKS = 10; // setup the arrays for users, gamepersons and groups const users = []; @@ -195,6 +195,9 @@ export class ReplayService { for (let i = 1; i < USER_LOCATIONS + 1; i++) { let date: number = Date.now(); let x = 1; + // score ticks with players to sync them + await this.scoreService.scoreTick(gameId); + // add location entry for each gameperson await Promise.all( gamepersons.map(async gameperson => { // format player locations with x-modifier that same factions are closer to each other @@ -214,10 +217,6 @@ export class ReplayService { }), ); } - // generate x-amount of score tick - for (let i = 0; i < SCORE_TICKS; i++) { - await this.scoreService.scoreTick(gameId); - } return { message: 'all done', -- GitLab