From b370a6880dd514aacc3b0ac2cb056ce2d6f9bf81 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sun, 30 Apr 2017 09:12:08 -0400 Subject: [PATCH] Cleanup and remove dumb comments. --- xonstat/views/main.py | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/xonstat/views/main.py b/xonstat/views/main.py index af6ae9b..0c21f5a 100644 --- a/xonstat/views/main.py +++ b/xonstat/views/main.py @@ -172,36 +172,30 @@ def _main_index_data(request): leaderboard_count = 10 recent_games_count = 20 - # summary statistics for the tagline stat_line = get_summary_stats("all") day_stat_line = get_summary_stats("day") ranks = [get_ranks(gt) for gt in RANKED_GAME_TYPES if get_ranks(gt)] - right_now = datetime.utcnow() - back_then = datetime.utcnow() - timedelta(days=leaderboard_lifetime) - - # top players by playing time - top_players = get_top_players_by_time(10) + top_players = get_top_players_by_time(leaderboard_count) - # top servers by number of games - top_servers = get_top_servers_by_games(10) + top_servers = get_top_servers_by_games(leaderboard_count) - # top maps by total times played - top_maps = get_top_maps_by_games(10) + top_maps = get_top_maps_by_games(leaderboard_count) - # recent games played in descending order + back_then = datetime.utcnow() - timedelta(days=leaderboard_lifetime) rgs = recent_games_q(cutoff=back_then).limit(recent_games_count).all() recent_games = [RecentGame(row) for row in rgs] - return {'top_players':top_players, - 'top_servers':top_servers, - 'top_maps':top_maps, - 'recent_games':recent_games, - 'ranks':ranks, - 'stat_line':stat_line, - 'day_stat_line':day_stat_line, - } + return { + 'top_players': top_players, + 'top_servers': top_servers, + 'top_maps': top_maps, + 'recent_games': recent_games, + 'ranks': ranks, + 'stat_line': stat_line, + 'day_stat_line': day_stat_line, + } def main_index(request): -- 2.39.2