Esempio n. 1
0
    def get_table(self):
        table = TabbycatTableBuilder(view=self, sort_key="Rk")

        try:
            standings, rounds = self.get_standings()
        except StandingsError as e:
            messages.error(self.request, self.get_standings_error_message(e))
            logger.exception("Error generating standings: " + str(e))
            return table

        # Easiest to redact info here before passing to column constructors
        if hasattr(self, 'public_page_preference'):
            for info in standings:
                if info.speaker.anonymous:
                    info.speaker.anonymise = True
                    info.speaker.team.anonymise = True

        table.add_ranking_columns(standings)
        table.add_speaker_columns([info.speaker for info in standings])
        table.add_team_columns([info.speaker.team for info in standings])

        scores_headers = [round.abbreviation for round in rounds]
        scores_data = [
            list(map(metricformat, standing.scores)) for standing in standings
        ]
        table.add_columns(scores_headers, scores_data)
        table.add_metric_columns(standings)

        return table
Esempio n. 2
0
    def get_table(self):
        table = TabbycatTableBuilder(view=self, sort_key="rk")

        try:
            standings, rounds = self.get_standings()
        except StandingsError as e:
            messages.error(self.request, self.get_standings_error_message(e))
            logger.exception("Error generating standings: " + str(e))
            return table

        # Easiest to redact info here before passing to column constructors
        if hasattr(self, 'public_page_preference'):
            for info in standings:
                if info.speaker.anonymous:
                    info.speaker.anonymise = True
                    info.speaker.team.anonymise = True

        table.add_ranking_columns(standings)
        table.add_speaker_columns([info.speaker for info in standings])
        table.add_team_columns([info.speaker.team for info in standings])

        scores_headers = [{'key': round.abbreviation, 'title': round.abbreviation} for round in rounds]
        scores_data = [[metricformat(x) if x is not None else '—' for x in standing.scores] for standing in standings]
        table.add_columns(scores_headers, scores_data)
        table.add_metric_columns(standings, integer_score_columns=self.integer_score_columns(rounds))

        return table
Esempio n. 3
0
    def get_table(self):
        standings, rounds = self.get_standings()
        table = TabbycatTableBuilder(view=self, sort_key="Rk")

        table.add_ranking_columns(standings)
        table.add_speaker_columns([info.speaker for info in standings])
        table.add_team_columns([info.speaker.team for info in standings])

        scores_headers = [round.abbreviation for round in rounds]
        scores_data = [list(map(metricformat, standing.scores)) for standing in standings]
        table.add_columns(scores_headers, scores_data)
        table.add_metric_columns(standings)

        return table
Esempio n. 4
0
    def get_table(self):
        tournament = self.get_tournament()
        teams = tournament.team_set.all()
        rounds = tournament.prelim_rounds()

        tpas = dict()
        for tpa in TeamPositionAllocation.objects.filter(round__in=rounds):
            tpas[(tpa.team.id, tpa.round.seq)] = TPA_MAP[tpa.position]

        table = TabbycatTableBuilder(view=self)
        table.add_team_columns(teams)

        headers = [round.abbreviation for round in rounds]
        data = [[tpas.get((team.id, round.id), "—") for round in rounds] for team in teams]
        table.add_columns(headers, data)

        return table
Esempio n. 5
0
    def get_table(self):
        teams = self.tournament.team_set.all()
        rounds = self.tournament.prelim_rounds()

        tsas = dict()
        for tsa in TeamSideAllocation.objects.filter(round__in=rounds):
            try:
                tsas[(tsa.team.id, tsa.round.seq)] = get_side_name(self.tournament, tsa.side, 'abbr')
            except ValueError:
                pass

        table = TabbycatTableBuilder(view=self)
        table.add_team_columns(teams)

        headers = [round.abbreviation for round in rounds]
        data = [[tsas.get((team.id, round.seq), "—") for round in rounds] for team in teams]
        table.add_columns(headers, data)

        return table
Esempio n. 6
0
    def get_table(self):
        teams = self.tournament.team_set.all()
        rounds = self.tournament.prelim_rounds()

        tsas = dict()
        for tsa in TeamSideAllocation.objects.filter(round__in=rounds):
            try:
                tsas[(tsa.team.id, tsa.round.seq)] = get_side_name(self.tournament, tsa.side, 'abbr')
            except ValueError:
                pass

        table = TabbycatTableBuilder(view=self)
        table.add_team_columns(teams)

        headers = [round.abbreviation for round in rounds]
        data = [[tsas.get((team.id, round.seq), "—") for round in rounds] for team in teams]
        table.add_columns(headers, data)

        return table
Esempio n. 7
0
    def get_table(self):
        tournament = self.get_tournament()
        teams = tournament.team_set.all()
        rounds = tournament.prelim_rounds()

        tpas = dict()
        for tpa in TeamPositionAllocation.objects.filter(round__in=rounds):
            try:
                tpas[(tpa.team.id, tpa.round.seq)] = get_position_name(
                    tournament, self.TPA_MAP[tpa.position], 'abbr')
            except ValueError:
                pass

        table = TabbycatTableBuilder(view=self)
        table.add_team_columns(teams)

        headers = [round.abbreviation for round in rounds]
        data = [[tpas.get((team.id, round.id), "—") for round in rounds]
                for team in teams]
        table.add_columns(headers, data)

        return table