Esempio n. 1
0
    def get_table_by_team(self):
        round = self.get_round()
        tournament = self.get_tournament()
        teamscores = TeamScore.objects.filter(
            debate_team__debate__round=round,
            ballot_submission__confirmed=True).prefetch_related(
                'debate_team__team__speaker_set',
                'debate_team__team__institution',
                'debate_team__debate__debateadjudicator_set__adjudicator',
                'debate_team__debate__debateteam_set__team',
                'debate_team__debate__round').select_related(
                    'ballot_submission')
        debates = [ts.debate_team.debate for ts in teamscores]

        if tournament.pref('teams_in_debate') == 'two':
            populate_opponents([ts.debate_team for ts in teamscores])
        populate_confirmed_ballots(
            debates,
            motions=True,
            results=tournament.pref('ballots_per_debate') == 'per-adj')

        table = TabbycatTableBuilder(view=self, sort_key=_("Team"))
        table.add_team_columns([ts.debate_team.team for ts in teamscores])
        table.add_debate_result_by_team_column(teamscores)
        table.add_debate_side_by_team_column(teamscores)
        if not (tournament.pref('teams_in_debate') == 'bp'
                and round.is_break_round):
            table.add_debate_ballot_link_column(debates)
        table.add_debate_adjudicators_column(debates, show_splits=True)

        if tournament.pref('show_motions_in_results'):
            table.add_debate_motion_column(debates)

        return table
Esempio n. 2
0
    def get_table_by_team(self):
        teamscores = TeamScore.objects.filter(
            debate_team__debate__round=self.round,
            ballot_submission__confirmed=True).prefetch_related(
            'debate_team__team__speaker_set',
            'debate_team__debate__debateadjudicator_set__adjudicator',
            'debate_team__debate__debateadjudicator_set__adjudicator__institution',
            'debate_team__debate__debateteam_set__team').select_related(
            'ballot_submission',
            'debate_team__team__institution',
            'debate_team__debate__round')
        debates = [ts.debate_team.debate for ts in teamscores]

        if self.tournament.pref('teams_in_debate') == 'two':
            populate_opponents([ts.debate_team for ts in teamscores])
        populate_confirmed_ballots(debates, motions=True,
            results=self.round.ballots_per_debate == 'per-adj')

        table = TabbycatTableBuilder(view=self, sort_key="team")
        table.add_team_columns([ts.debate_team.team for ts in teamscores])
        table.add_debate_result_by_team_column(teamscores)
        table.add_debate_side_by_team_column(teamscores, self.tournament)
        if not (self.tournament.pref('teams_in_debate') == 'bp' and self.round.is_break_round):
            table.add_debate_ballot_link_column(debates)
        table.add_debate_adjudicators_column(debates, show_splits=True)

        if self.tournament.pref('show_motions_in_results'):
            table.add_debate_motion_column(debates)

        return table