Order Player chars list based on choices in conf()

master
Lertsenem 2020-07-07 16:08:47 +02:00
parent a21e8f80b6
commit f5350d506f
1 changed files with 8 additions and 1 deletions

View File

@ -122,8 +122,15 @@ class Player():
# -------------------------------------------------------------------------
def conf(self):
# The char list looks like 'character1 (12.08), character2 (3.02)'
# where the number between parenthesis is the number of time the
# character was played
charslist = ", ".join(
[ "{} ({:.2f})".format(c,self.chars[c]) for c in self.chars ]
[ "{} ({:.2f})".format(c,n) for c,n in sorted(
self.chars.items(),
key = lambda cv: cv[1],
reverse = True,
) ]
)
return """