Remove Persona since it was shut down. :(
[xonotic/xonstat.git] / xonstat / models / main.py
1 """
2 Models related to the main index page.
3 """
4
5 from xonstat.util import html_colors
6
7
8 class SummaryStat(object):
9     """
10     The high level summary line that is shown on the main page.
11     """
12
13     def __repr__(self):
14         return ("<SummaryStat(total_players={0.total_players}, total_games={0.total_games}, "
15                 "total_servers={0.total_servers})>".format(self))
16
17
18 class ActivePlayer(object):
19     """
20     A record in the "Most Active Players" list.
21     """
22
23     def __init__(self, sort_order=None, player_id=None, nick=None, alivetime=None):
24         self.sort_order = sort_order
25         self.player_id = player_id
26         self.nick = nick
27         self.alivetime = alivetime
28
29     def nick_html_colors(self):
30         return html_colors(self.nick)
31
32     def __repr__(self):
33         return "<ActivePlayer({0.sort_order}, {0.player_id})>".format(self)
34
35
36 class ActiveServer(object):
37     """
38     A record in the "Most Active Servers" list.
39     """
40
41     def __init__(self, sort_order=None, server_id=None, server_name=None, games=None):
42         self.sort_order = sort_order
43         self.server_id = server_id
44         self.server_name = server_name
45         self.games = games
46
47     def __repr__(self):
48         return "<ActiveServer({0.sort_order}, {0.server_id})>".format(self)
49
50
51 class ActiveMap(object):
52     """
53     A record in the "Most Active Maps" list.
54     """
55
56     def __init__(self, sort_order=None, map_id=None, map_name=None, games=None):
57         self.sort_order = sort_order
58         self.map_id = map_id
59         self.map_name = map_name
60         self.games = games
61
62     def __repr__(self):
63         return "<ActiveMap({0.sort_order}, {0.map_id})>".format(self)