From 0054cde3de9bf50b49c2c67f3295a7c39b195a63 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Tue, 7 Feb 2017 22:21:25 -0500 Subject: [PATCH] Update the has_required_metadata function to use the new object. --- xonstat/views/submission.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/xonstat/views/submission.py b/xonstat/views/submission.py index c090589..89c3efb 100644 --- a/xonstat/views/submission.py +++ b/xonstat/views/submission.py @@ -287,6 +287,14 @@ def is_blank_game(submission): return not (submission.human_nonzero_score and submission.human_fired_weapon) +def has_required_metadata(submission): + """Determines if a submission has all the required metadata fields.""" + return (submission.game_type_cd is not None + and submission.map_name is not None + and submission.match_id is not None + and submission.server_name is not None) + + def get_remote_addr(request): """Get the Xonotic server's IP address""" if 'X-Forwarded-For' in request.headers: @@ -414,20 +422,7 @@ def has_minimum_real_players(settings, player_events): return flg_has_min_real_players -def has_required_metadata(metadata): - """ - Determines if a give set of metadata has enough data to create a game, - server, and map with. - """ - flg_has_req_metadata = True - - if 'G' not in metadata or\ - 'M' not in metadata or\ - 'I' not in metadata or\ - 'S' not in metadata: - flg_has_req_metadata = False - return flg_has_req_metadata def should_do_weapon_stats(game_type_cd): -- 2.39.2