summaryrefslogtreecommitdiff
path: root/jfr_playoff/dto.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-02-25 11:17:24 +0100
committeremkael <emkael@tlen.pl>2018-02-25 11:17:24 +0100
commita8aa671f49152dc7975de9bd62b929aab0ff309b (patch)
tree642dca7069a98644e54d526d8255a2ac7364cbff /jfr_playoff/dto.py
parent70a74524095166ee349603e2d48f2cf7c6c5f118 (diff)
parent8c500a75a6eafd65b332d0f8346d9059d5293cbb (diff)
Merge branch 'verbose_logging' into devel
Diffstat (limited to 'jfr_playoff/dto.py')
-rw-r--r--jfr_playoff/dto.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/jfr_playoff/dto.py b/jfr_playoff/dto.py
index f5e08ef..a1b3a7f 100644
--- a/jfr_playoff/dto.py
+++ b/jfr_playoff/dto.py
@@ -1,7 +1,15 @@
+import sys
+
class Team(object):
name = ''
score = 0.0
+ def __unicode__(self):
+ return u'%s (%.1f)' % (self.name, self.score)
+
+ def __repr__(self):
+ return unicode(self).encode(sys.stdin.encoding)
+
class Match(object):
id = None
@@ -13,6 +21,13 @@ class Match(object):
winner_matches = None
loser_matches = None
+ def __repr__(self):
+ return (u'#%d (%s) %s [%s]' % (
+ self.id, self.link, [unicode(team) for team in self.teams],
+ u'finished' if self.running < 0 else (
+ u'%d boards' % self.running))
+ ).encode(sys.stdin.encoding)
+
class Phase(object):
title = None
@@ -20,4 +35,9 @@ class Phase(object):
matches = []
running = False
+ def __repr__(self):
+ return u'%s (%s) <%d matches> [%srunning]' % (
+ self.title, self.link,
+ len(self.matches), '' if self.running else 'not ')
+
__all__ = ('Team', 'Match', 'Phase')