++ make points a bit nicer

This commit is contained in:
Nico Schottelius 2019-05-26 22:37:58 +02:00
parent a2193fd096
commit 7272edb7d5

View file

@ -189,6 +189,9 @@ class Game(object):
point_path = "{}/points".format(user.key) point_path = "{}/points".format(user.key)
points = self.read_etcd(point_path, recursive=True) points = self.read_etcd(point_path, recursive=True)
if not points:
continue
for challenge in points.children: for challenge in points.children:
user_points[username] += int(challenge.value) user_points[username] += int(challenge.value)
@ -217,7 +220,11 @@ https://code.ungleich.ch/nico/ungleich-game
for k, v in point_list.items(): for k, v in point_list.items():
res.append("{} has {} points".format(k, v)) res.append("{} has {} points".format(k, v))
return "\n".join(res) return """
Point list (aka high score)
---------------------------
{}
""".format("\n".join(res))
def register(self): def register(self):
args = require_args("user") args = require_args("user")