From 903e1f202fc0add9c6b8674922bd70a59ce2701d Mon Sep 17 00:00:00 2001
From: L4168 <L4168@student.jamk.fi>
Date: Mon, 8 Jul 2019 13:06:18 +0300
Subject: [PATCH] fix join-faction bug

---
 src/faction/faction.service.ts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/faction/faction.service.ts b/src/faction/faction.service.ts
index e6bec65..014188e 100644
--- a/src/faction/faction.service.ts
+++ b/src/faction/faction.service.ts
@@ -35,7 +35,12 @@ export class FactionService {
         person: person,
       });
       //check if user is already in a faction
-      if (await this.game_PersonRepository.findOne(gameperson)) {
+      if (
+        await this.game_PersonRepository.findOne({
+          person: person,
+          game: faction.game,
+        })
+      ) {
         throw new HttpException(
           'You have already joined faction!',
           HttpStatus.BAD_REQUEST,
-- 
GitLab