]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Get rid of joined_pretty_date in favor of the mixin. models-refactor
authorAnt Zucaro <azucaro@gmail.com>
Sun, 6 Nov 2016 00:17:50 +0000 (20:17 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 6 Nov 2016 00:17:50 +0000 (20:17 -0400)
xonstat/models/player.py
xonstat/templates/player_index.mako
xonstat/templates/player_info.mako
xonstat/templates/search.mako

index 5b7f97beec333af24238840023e168ffb78931f6..d9df0759d628a8d3bbb06a30dfcc9fa745e442f6 100644 (file)
@@ -8,7 +8,7 @@ from xonstat.models.mixins import FuzzyDateMixin, EpochMixin, NickColorsMixin
 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.
     """
@@ -19,10 +19,6 @@ class Player(EpochMixin, NickColorsMixin):
         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'))
 
index 6ef400f58b1a462f5e66d04a3b64ee1b08543ee8..c991f70c683398aa88b9f772c94d7ebda55aaa7a 100644 (file)
@@ -42,7 +42,7 @@
         <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>
index 2d39e103b89e613fff6bdbf540d296ebeb9f908c..956d335f96a1f4a1e29588ae61813b25b7087e7c 100644 (file)
@@ -66,7 +66,7 @@
     </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
index 45bf794897180f3e87706628eb8a645666e35176..69013b0c30943555f407537d9ce08399c7897f9b 100644 (file)
             <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>