From 6fbf48dcd658db76d6ccd375ac9e8b0f5123df18 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 10 Mar 2021 16:06:42 +0100 Subject: /user/games opponent user_format + oppponent fix --- api/api.ts | 2 +- api/user/games.py | 3 ++- components/recentGames.tsx | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/api.ts b/api/api.ts index 0b37441..1db6e0e 100644 --- a/api/api.ts +++ b/api/api.ts @@ -50,7 +50,7 @@ export interface gameInfo { duration: number; id: string; moves: Array; - opponent: string; + opponent: userInfo; outcome: outcome; parent?: string; private: boolean; diff --git a/api/user/games.py b/api/user/games.py index 95bd38a..c61151a 100644 --- a/api/user/games.py +++ b/api/user/games.py @@ -3,6 +3,7 @@ from functools import reduce from mergedeep import merge from db import cursor from auth.login_token import token_login +from user.info import format_user from ruleset import resolve_ruleset import json @@ -30,7 +31,7 @@ def game_info(game_id, user_id = None): "id": game[0], "parent": game[1], "moves": [int(move) for move in str(game[2]).split(",")], - "opponent": game[3] if is_player_1 else game[4], + "opponent": format_user(game[4] if is_player_1 else game[3]), "outcome": outcome, "created": game[6], "started": game[7], diff --git a/components/recentGames.tsx b/components/recentGames.tsx index 9e87b61..750a9e7 100644 --- a/components/recentGames.tsx +++ b/components/recentGames.tsx @@ -43,7 +43,7 @@ export default function RecentGames(props: { games?: Array }) { { props.games?.map(game => - {game.opponent} + {game.opponent.username} {game.moves.length -1} {(() => { -- cgit v1.2.3