From 1161b2a7d65b5381da311aa7a11516e79a49a51b Mon Sep 17 00:00:00 2001
From: Ronnie Friman <L4168@student.jamk.fi>
Date: Tue, 16 Jul 2019 19:53:26 +0300
Subject: [PATCH] mockdata

---
 src/replay/replay.service.ts | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/replay/replay.service.ts b/src/replay/replay.service.ts
index 50d79da..dcc9738 100644
--- a/src/replay/replay.service.ts
+++ b/src/replay/replay.service.ts
@@ -78,14 +78,17 @@ export class ReplayService {
       where: { id: gameId },
       relations: ['factions'],
     });
-    for (let i = 0; i < 20; i++) {
+    const groups = await this.factionService.showGroups(
+      game.factions[0].factionId,
+    );
+    for (let i = 0; i < 100; i++) {
       let res = await this.userService.register({
-        name: 'qqqqq' + i,
+        name: 'asdf' + i,
         password: 'asd',
       });
       let user = await jwt.verify(res.token, process.env.SECRET);
       users.push(user);
-      let gameperson = await this.factionService.joinFaction(user['id'], {
+      /*       let gameperson = await this.factionService.joinFaction(user['id'], {
         factionId:
           i < 10 ? game.factions[0].factionId : game.factions[1].factionId,
         factionPassword:
@@ -93,6 +96,14 @@ export class ReplayService {
             ? game.factions[0].factionPassword
             : game.factions[1].factionPassword,
         game: gameId,
+      }); */
+      let gameperson = await this.factionService.joinFaction(user['id'], {
+        factionId: game.factions[0].factionId,
+        factionPassword: game.factions[0].factionPassword,
+        game: gameId,
+      });
+      await this.factionService.joinGroup(gameperson, {
+        groupId: groups[Math.floor(Math.random() * 3)],
       });
       gamepersons.push(gameperson);
     }
@@ -101,7 +112,7 @@ export class ReplayService {
     let x1 = 62.3;
     let y2 = 25.75;
     let x2 = 62.35;
-    for (let i = 1; i < 16 * 6 * 3; i++) {
+    for (let i = 1; i < 6; i++) {
       let x = 0;
       date += 10000;
       await Promise.all(
-- 
GitLab