コード例 #1
0
ファイル: tourney.py プロジェクト: bernd-wechner/CoGs
 def __rich_str__(self, link=None):
     name = field_render(self.name, link_target_url(self, link))
     games = ", ".join([
         field_render(g.name, link_target_url(g, link))
         for g in self.games.all()
     ])
     return f'{name} - {games}'
コード例 #2
0
 def __rich_str__(self, link=None):
     name = field_render(self.name, link_target_url(self, link))
     pmin = self.min_players
     pmax = self.max_players
     beta = self.trueskill_beta
     tau = self.trueskill_tau * 100
     p = int(self.trueskill_p * 100)
     return f'{name} (plays {pmin}-{pmax}), Skill factor: {beta:0.2f}, Draw probability: {p:d}%, Skill dynamics factor: {tau:0.2f}'
コード例 #3
0
ファイル: tourney.py プロジェクト: bernd-wechner/CoGs
    def __detail_str__(self, link=None):
        rules = {}
        for r in self.rules.all():
            rules[r.game] = r

        game_detail = {}
        for g in self.games.all():
            if g in rules:
                game_detail[g] = field_render(
                    g.name, link_target_url(g, link)
                ) + f": min_plays={rules[g].min_plays}, weight={rules[g].weight}"
            else:
                game_detail[g] = field_render(g.name, link_target_url(
                    g, link)) + "Error: rules are missing!"

        name = field_render(self.name, link_target_url(self, link))
        games = "</li><li>".join([game_detail[g] for g in self.games.all()])
        games = f"<ul><li>{games}</li></ul"
        return f'{name}:{games}'
コード例 #4
0
 def __rich_str__(self, link=None):
     if self.session is None:  # Don't crash of the rank is orphaned!
         game = "<no game>"
         team_play = False
         ranker = field_render(self.player, link)
     else:
         game = field_render(self.session.game, link)
         team_play = self.session.team_play
         ranker = field_render(self.team,
                               link) if team_play else field_render(
                                   self.player, link)
     return u'{} - {} - {}'.format(
         game, field_render(self.rank, link_target_url(self, link)), ranker)
コード例 #5
0
 def __rich_str__(self, link=None):
     if self.session is None:  # Don't crash of the performance is orphaned!
         when = "<no time>"
         game = "<no game>"
     else:
         when = self.session.date_time
         game = field_render(self.session.game, link)
     performer = field_render(self.player, link)
     performance = "{:.0%} participation, play number {}, {:+.1f} teeth".format(
         self.partial_play_weighting, self.play_number,
         self.trueskill_eta_after - self.trueskill_eta_before)
     return u'{} - {:%d, %b %Y} - {}: {}'.format(
         game, when, performer,
         field_render(performance, link_target_url(self, link)))
コード例 #6
0
    def __rich_str__(self, link=None):
        games = self.games_played
        if len(games) > 2:
            game_str = ", ".join(
                map(lambda g: field_render(g, link), games[0:1])) + "..."
        elif len(games) > 0:
            game_str = ", ".join(map(lambda g: field_render(g, link), games))
        else:
            game_str = html.escape("<No Game>")

        name = field_render(self.name, link_target_url(
            self, link)) if self.name else ""
        return name + u" (" + u", ".join(
            [field_render(p, link)
             for p in self.players.all()]) + u") for " + game_str
コード例 #7
0
 def __detail_str__(self, link=None):
     if self.session is None:  # Don't crash of the rank is orphaned!
         game = "<no game>"
         team_play = False
         ranker = field_render(self.player, link)
         mode = "individual"
     else:
         game = field_render(self.session.game, link)
         team_play = self.session.team_play
         ranker = field_render(self.team,
                               link) if team_play else field_render(
                                   self.player, link)
         mode = "team" if team_play else "individual"
     return u'{} - {} - {} ({} play)'.format(
         game, field_render(self.rank, link_target_url(self, link)), ranker,
         mode)
コード例 #8
0
    def __detail_str__(self, link=None):
        if self.name:
            detail = field_render(self.name, link_target_url(self, link))
        else:
            detail = html.escape("<Nameless Team>")

        games = self.games_played
        if len(games) > 2:
            game_str = ", ".join(
                map(lambda g: field_render(g, link), games[0:1])) + "..."
        elif len(games) > 0:
            game_str = ", ".join(map(lambda g: field_render(g, link), games))
        else:
            game_str = html.escape("<no game>")

        detail += " for " + game_str + "<UL>"
        for p in self.players.all():
            detail += "<LI>{}</LI>".format(field_render(p, link))
        detail += "</UL>"
        return detail
コード例 #9
0
ファイル: tourney.py プロジェクト: bernd-wechner/CoGs
 def __rich_str__(self, link=None):
     tourney_name = field_render(self.tourney.name,
                                 link_target_url(self.tourney, link))
     game_name = field_render(self.game.name,
                              link_target_url(self.game, link))
     return f'{tourney_name} - {game_name}: min_plays={self.min_plays}, weight={self.weight}'
コード例 #10
0
ファイル: player.py プロジェクト: bernd-wechner/CoGs
 def __rich_str__(self, link=None):
     return u'{} - {}'.format(
         field_render(self.__verbose_str__(), link_target_url(self, link)),
         field_render(self.email_address,
                      link if link == flt.none else flt.mailto))