From 5f39e8c7d096df20e237c4bac7a97e339ed4fce5 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Tue, 10 Jul 2018 13:02:57 -0700 Subject: [PATCH] Fixing edge case with finding last game type played --- app/quake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/quake.py b/app/quake.py index 7acf0594..60f50381 100644 --- a/app/quake.py +++ b/app/quake.py @@ -163,7 +163,7 @@ def get_match_stats(blob, target_player): """ # Figure out which ranked gametype they last played - game_type = [x for x in blob['playerRatings'] if blob['playerRatings'][x]['lastChange'] != 0][0] + game_type = 'tdm' if blob['playerRatings']['tdm']['lastUpdated'] < blob['playerRatings']['duel']['lastUpdated'] else 'duel' most_recent_match_id = blob['playerRatings'][game_type]['history'][0]['sessionId'] match_endpoint = "Player/Games?id={}".format(most_recent_match_id)