]> git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/models/map.py
If no frag matrix row is found, show zeros.
[xonotic/xonstat.git] / xonstat / models / map.py
index befa34600a0fb6cf8078d576e9240612694c3fd4..6da00eb31b3bd776a0874d2c29230c3f8cfc7572 100644 (file)
@@ -4,10 +4,11 @@ Models related to maps.
 
 from calendar import timegm
 
+from xonstat.models.mixins import FuzzyDateMixin, EpochMixin
 from xonstat.util import pretty_date, strip_colors, html_colors
 
 
-class Map(object):
+class Map(FuzzyDateMixin, EpochMixin):
     """
     A playable map. Roughly equivalent to a pk3 file, but distinguished by name instead.
     """
@@ -23,14 +24,10 @@ class Map(object):
             'map_id': self.map_id,
             'name': self.name,
             'version': self.version,
+            'create_dt_fuzzy': self.fuzzy_date(),
+            'create_dt_epoch': self.epoch(),
         }
 
-    def fuzzy_date(self):
-        return pretty_date(self.create_dt)
-
-    def epoch(self):
-        return timegm(self.create_dt.timetuple())
-
 
 # TODO: investigate if this model is truly a model, or really just a query (i.e. namedtuple)
 class MapCapTime(object):