from xonstat.util import strip_colors, pretty_date, qfont_decode
-class Player(EpochMixin, NickColorsMixin):
+class Player(EpochMixin, NickColorsMixin, FuzzyDateMixin):
"""
A player, which can represent either a human or a bot.
"""
else:
return strip_colors(self.nick)
- # TODO: use FuzzyDateMixin instead, but change the method calls
- def joined_pretty_date(self):
- return pretty_date(self.create_dt)
-
def __repr__(self):
return "<Player({}, {})>".format(self.player_id, self.nick.encode('utf-8'))
<tr>
<td>${player.player_id}</th>
<td class="no-stretch"><a href="${request.route_url("player_info", id=player.player_id)}" title="Go to this player's info page">${player.nick_html_colors()|n}</a></th>
- <td><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${player.joined_pretty_date()}</span></th>
+ <td><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${player.fuzzy_date()}</span></th>
<td class="text-center">
<a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="View recent games by this player">
<i class="fa fa-list"></i>
</h2>
<h5>
- <i><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">Joined ${player.joined_pretty_date()}</span> (player #${player.player_id})</i>
+ <i><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">Joined ${player.fuzzy_date()}</span> (player #${player.player_id})</i>
% if cake_day:
<img src="/static/images/icons/24x24/cake.png" title="Happy cake day!" />
% endif
<tr>
<td>${player.player_id}</th>
<td class="no-stretch"><a href="${request.route_url("player_info", id=player.player_id)}" title="Go to this player's info page">${player.nick_html_colors()|n}</a></th>
- <td><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${player.joined_pretty_date()}</span></th>
+ <td><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${player.fuzzy_date()}</span></th>
<td class="text-center">
<a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="View recent games by this player">
<i class="fa fa-list"></i>