X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonstat.git;a=blobdiff_plain;f=xonstat%2Fviews%2Fsubmission.py;h=89efdb18514914f34b96e606ea21a5549fd762b5;hp=b4059e5ad06c2bbe3863587c7b3499ed0f5521b1;hb=43fea814d8b5b80bd3616c3290ae8a107bd4e55f;hpb=7c76a3df34755d10ea82d4c150b7c475e2c270b9;ds=sidebyside diff --git a/xonstat/views/submission.py b/xonstat/views/submission.py index b4059e5..89efdb1 100644 --- a/xonstat/views/submission.py +++ b/xonstat/views/submission.py @@ -1044,6 +1044,25 @@ def get_or_create_players(session, events_by_hashkey): return players_by_hashkey +def create_frag_matrix(pgstat, events): + """ + Construct a PlayerFragMatrix object from the events of a given player. + + :param pgstat: The PlayerGameStat object of the player whose frag matrix we want to create. + :param events: The raw player events of the above player. + :return: PlayerFragMatrix + """ + player_index = events.get("i", None) + + # "kills-4" -> 4 + victim_index = lambda x: int(x.split("-")[1]) + + # TODO: prune these events to only those corresponding to players who played in the game + matrix = {victim_index(k): int(v) for (k, v) in events if k.startswith("kills-")} + + return None + + def submit_stats(request): """ Entry handler for POST stats submissions.