From 06149cde2e35e378dc9bb8cf8c1a1c0ad3451ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=9B=90=EC=A0=95?= Date: Mon, 11 Mar 2024 15:30:13 +0900 Subject: [PATCH 1/2] =?UTF-8?q?hotfix:=20=EB=A8=BC=EC=A0=80=20=EB=81=9D?= =?UTF-8?q?=EB=82=9C=20=EC=82=AC=EB=9E=8C=20500=EC=97=90=EB=9F=AC=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/games/serializers.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/backend/games/serializers.py b/backend/games/serializers.py index f6e8e4f6..c824e85c 100644 --- a/backend/games/serializers.py +++ b/backend/games/serializers.py @@ -267,19 +267,25 @@ class Meta: fields = ['match1', 'match2', 'match3'] def get_match1(self, game): - return MatchSerializer(game.match1).data + if game.match1 is not None and game.match1.player1 is not None and game.match1.player2 is not None: + return MatchSerializer(game.match1).data + return None def get_match2(self, game): - return MatchSerializer(game.match2).data + if game.match2 is not None and game.match2.player1 is not None and game.match2.player2 is not None: + return MatchSerializer(game.match2).data + return None def get_match3(self, game): - data = MatchSerializer(game.match3).data - if game.match3.winner is None: - data['winner'] = None - else: - data['winner'] = game.match3.winner.nickname - data['date'] = game.started_at - return data + if game.match3 is not None and game.match3.player1 is not None and game.match3.player2 is not None: + data = MatchSerializer(game.match3).data + if game.match3.winner is None: + data['winner'] = None + else: + data['winner'] = game.match3.winner.nickname + data['date'] = game.started_at + return data + return None class PvPMatchSerializer(serializers.ModelSerializer): From f3de55ee3e2cee9be4f327865c96a731a0fcdbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=9B=90=EC=A0=95?= Date: Mon, 11 Mar 2024 15:30:34 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EA=B0=81=20=EC=86=8C=EC=BC=93=20?= =?UTF-8?q?=EB=A9=94=EC=84=B8=EC=A7=80=20=ED=95=9C=20=EB=B2=88=EB=A7=8C=20?= =?UTF-8?q?=EA=B0=80=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/games/consumers/GameConsumer.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/backend/games/consumers/GameConsumer.py b/backend/games/consumers/GameConsumer.py index afe0894a..a16a76d8 100644 --- a/backend/games/consumers/GameConsumer.py +++ b/backend/games/consumers/GameConsumer.py @@ -372,10 +372,10 @@ async def _send_end_message(self, match: Result): 'data': data } ) - await self.game_end({ - 'type': type_, - 'data': data - }) + # await self.game_end({ + # 'type': type_, + # 'data': data + # }) async def _send_start_message(self, match, group_name): data = { @@ -409,10 +409,10 @@ async def _send_start_message(self, match, group_name): 'data': data } ) - await self.game_start({ - 'type': 'game_start', - 'data': data - }) + # await self.game_start({ + # 'type': 'game_start', + # 'data': data + # }) async def _send_in_game_message(self, match, group_name): data = { @@ -438,10 +438,10 @@ async def _send_in_game_message(self, match, group_name): 'data': data } ) - await self.in_game({ - 'type': 'in_game', - 'data': data - }) + # await self.in_game({ + # 'type': 'in_game', + # 'data': data + # }) async def game_info(self, event): try: