From: Ant Zucaro Date: Sat, 7 Oct 2017 13:06:23 +0000 (-0400) Subject: Only store frag matrix rows if there is actually something in them. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4921873791d8dfb088c585e81e8272459e64d8b4;p=xonotic%2Fxonstat.git Only store frag matrix rows if there is actually something in them. --- diff --git a/xonstat/views/submission.py b/xonstat/views/submission.py index 0f2b3cd..a830a3f 100644 --- a/xonstat/views/submission.py +++ b/xonstat/views/submission.py @@ -1068,12 +1068,14 @@ def create_frag_matrix(session, player_indexes, pgstat, events): matrix = {victim_index(k): int(v) for (k, v) in events.items() if k.startswith("kills-") and victim_index(k) in player_indexes} - pfm = PlayerGameFragMatrix(pgstat.game_id, pgstat.player_game_stat_id, pgstat.player_id, - player_index, matrix) + if len(matrix) > 0: + pfm = PlayerGameFragMatrix(pgstat.game_id, pgstat.player_game_stat_id, pgstat.player_id, + player_index, matrix) - session.add(pfm) - - return pfm + session.add(pfm) + return pfm + else: + return None def submit_stats(request):