Skip to content

Commit

Permalink
refactor(game): game info user_id 관련 필드 integer로 통일 (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
middlefitting authored Feb 23, 2024
1 parent 39b0765 commit 221e50c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions backend/game/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,14 @@ async def handle_info_message(self, user_id, game_session):
"left_score": game_info.get("left_score"),
"right_score": game_info.get("right_score"),
"status": game_info.get("status"),
"winner": game_info.get("winner"),
"winner": int(game_info.get("winner")),
"screen_width": self.SCREEN_WIDTH,
"screen_height": self.SCREEN_HEIGHT,
"bar_width": self.BAR_WIDTH,
"bar_height": self.BAR_HEIGHT,
"circle_radius": self.CIRCLE_RADIUS,
"next_left_player": game_info.get("next_left_player"),
"next_right_player": game_info.get("next_right_player"),
"next_left_player": int(game_info.get("next_left_player")),
"next_right_player": int(game_info.get("next_right_player")),
})

async def handle_wait_message(self, user_id, time):
Expand Down Expand Up @@ -732,7 +732,7 @@ async def set_game_info(self, left_user_id, right_user_id, game_type, game_sessi
"left_score": "0",
"right_score": "0",
"status": self.BEFORE,
"winner": "NONE",
"next_left_player": str(next_left_player) if next_left_player is not None else "NONE",
"next_right_player": str(next_right_player) if next_right_player is not None else "NONE",
"winner": "0",
"next_left_player": str(next_left_player) if next_left_player is not None else "0",
"next_right_player": str(next_right_player) if next_right_player is not None else "0",
})
8 changes: 4 additions & 4 deletions backend/game/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,16 @@ class InfoGame(APIView):
'right_score': openapi.Schema(type=openapi.TYPE_INTEGER, description="오른쪽 유저 스코어"),
'status': openapi.Schema(type=openapi.TYPE_STRING, description="게임 상태",
enum=['before', 'start', 'end']),
'winner': openapi.Schema(type=openapi.TYPE_STRING,
description="우승자, None 이거나 결과 나오면 id 를 string으로 전송"),
'winner': openapi.Schema(type=openapi.TYPE_INTEGER,
description="우승자 pk, 0 이면 존재하지 않는 것"),
'bar_width': openapi.Schema(type=openapi.TYPE_INTEGER, description="바 너비"),
'bar_height': openapi.Schema(type=openapi.TYPE_INTEGER, description="바 높이"),
'circle_radius': openapi.Schema(type=openapi.TYPE_INTEGER, description="공 반지름"),
'screen_height': openapi.Schema(type=openapi.TYPE_INTEGER, description="맵 높이"),
'screen_width': openapi.Schema(type=openapi.TYPE_INTEGER, description="맵 너비"),
'next_left_player': openapi.Schema(type=openapi.TYPE_INTEGER, description="다음 게임 왼쪽 유저 pk"),
'next_right_player': openapi.Schema(type=openapi.TYPE_INTEGER, description="다음 게임 오른쪽 유저 pk"),
'next_left_player': openapi.Schema(type=openapi.TYPE_INTEGER, description="0일경우 존재하지 않음, 다음 게임 왼쪽 유저 pk"),
'next_right_player': openapi.Schema(type=openapi.TYPE_INTEGER, description="0일경우 존재하지 않음, 다음 게임 오른쪽 유저 pk"),
}
)),
})
Expand Down

0 comments on commit 221e50c

Please sign in to comment.