From 3484520bc88454d6cdad3132bacf1f4c8867a2c4 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sat, 12 Nov 2016 09:18:10 -0500 Subject: [PATCH] Add a filter to show active servers only. --- xonstat/views/server.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xonstat/views/server.py b/xonstat/views/server.py index 1421d06..5d9860c 100644 --- a/xonstat/views/server.py +++ b/xonstat/views/server.py @@ -32,7 +32,9 @@ class ServerIndex(object): def server_index(self): """Returns the raw data shared by all renderers.""" try: - server_q = DBSession.query(Server).order_by(Server.server_id.desc()) + server_q = DBSession.query(Server)\ + .filter(Server.active_ind==True)\ + .order_by(Server.server_id.desc()) servers = Page(server_q, self.page, items_per_page=25, url=page_url) except Exception as e: @@ -292,7 +294,11 @@ class ServerInfo(ServerInfoBase): # this view uses data from other views, so we'll save the data at that level try: - self.server = DBSession.query(Server).filter_by(server_id=self.server_id).one() + self.server = DBSession.query(Server)\ + .filter_by(active_ind=True) \ + .filter_by(server_id=self.server_id)\ + .one() + self.top_maps_v = ServerTopMaps(self.request, limit=LEADERBOARD_COUNT) self.top_scorers_v = ServerTopScorers(self.request, limit=LEADERBOARD_COUNT) self.top_players_v = ServerTopPlayers(self.request, limit=LEADERBOARD_COUNT) -- 2.39.2