Beispiel #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
Beispiel #2
0
    def get_table(self):
        """On adjudicator record pages, the table is the previous debates table."""
        debateadjs = DebateAdjudicator.objects.filter(
            adjudicator=self.object, ).select_related(
                'debate__round').prefetch_related(
                    Prefetch('debate__debateadjudicator_set',
                             queryset=DebateAdjudicator.objects.select_related(
                                 'adjudicator__institution')),
                    'debate__debateteam_set__team__speaker_set',
                    'debate__round__motion_set',
                )
        if not self.admin and not self.tournament.pref('all_results_released'):
            debateadjs = debateadjs.filter(
                debate__round__draw_status=Round.STATUS_RELEASED,
                debate__round__silent=False,
                debate__round__seq__lt=self.tournament.current_round.seq,
            )
        debates = [da.debate for da in debateadjs]
        populate_wins(debates)
        populate_confirmed_ballots(debates, motions=True, results=True)

        table = TabbycatTableBuilder(view=self,
                                     title=_("Previous Rounds"),
                                     sort_key="round")
        table.add_round_column([debate.round for debate in debates])
        table.add_debate_results_columns(debates)
        table.add_debate_adjudicators_column(debates,
                                             show_splits=True,
                                             highlight_adj=self.object)

        if self.admin or self.tournament.pref('public_motions'):
            table.add_debate_motion_column(debates)

        table.add_debate_ballot_link_column(debates)
        return table
Beispiel #3
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
Beispiel #4
0
    def get_table(self):
        """On adjudicator record pages, the table is the previous debates table."""
        debateadjs = DebateAdjudicator.objects.filter(
            adjudicator=self.object,
        ).select_related(
            'debate__round'
        ).prefetch_related(
            Prefetch('debate__debateadjudicator_set',
                queryset=DebateAdjudicator.objects.select_related('adjudicator__institution')),
            'debate__debateteam_set__team__speaker_set',
            'debate__round__motion_set',
        )
        if not self.admin and not self.tournament.pref('all_results_released'):
            debateadjs = debateadjs.filter(
                debate__round__draw_status=Round.STATUS_RELEASED,
                debate__round__silent=False,
                debate__round__seq__lt=self.tournament.current_round.seq,
            )
        debates = [da.debate for da in debateadjs]
        populate_wins(debates)
        populate_confirmed_ballots(debates, motions=True, results=True)

        table = TabbycatTableBuilder(view=self, title=_("Previous Rounds"), sort_key="round")
        table.add_round_column([debate.round for debate in debates])
        table.add_debate_results_columns(debates)
        table.add_debate_adjudicators_column(debates, show_splits=True, highlight_adj=self.object)

        if self.admin or self.tournament.pref('public_motions'):
            table.add_debate_motion_column(debates)

        table.add_debate_ballot_link_column(debates)
        return table
Beispiel #5
0
    def get_table_by_debate(self):
        debates = self.round.debate_set_with_prefetches(results=True,
                wins=True, institutions=True, adjudicators=True)
        populate_confirmed_ballots(debates, motions=True,
                results=self.round.ballots_per_debate == 'per-adj')

        table = TabbycatTableBuilder(view=self, sort_key="venue")
        table.add_debate_venue_columns(debates)
        table.add_debate_results_columns(debates)
        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
Beispiel #6
0
    def get_table_by_debate(self):
        debates = self.round.debate_set_with_prefetches(results=True,
                wins=True, institutions=True, adjudicators=True)
        populate_confirmed_ballots(debates, motions=True,
                results=self.round.ballots_per_debate == 'per-adj')

        table = TabbycatTableBuilder(view=self, sort_key="venue")
        table.add_debate_venue_columns(debates)
        table.add_debate_results_columns(debates)
        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
Beispiel #7
0
    def get_table(cls, view, participant):
        """On adjudicator record pages, the table is the previous debates table."""
        table = TabbycatTableBuilder(view=view,
                                     title=view.table_title,
                                     sort_key="round")

        debateadjs = DebateAdjudicator.objects.filter(
            adjudicator=participant, ).select_related(
                'debate__round',
                'debate__round__tournament',
            ).prefetch_related(
                Prefetch('debate__debateadjudicator_set',
                         queryset=DebateAdjudicator.objects.select_related(
                             'adjudicator__institution')),
                'debate__debateteam_set__team__speaker_set',
                'debate__round__motion_set',
            )
        if not table.admin and not view.tournament.pref(
                'all_results_released') and not table.private_url:
            debateadjs = debateadjs.filter(
                debate__round__draw_status=Round.STATUS_RELEASED,
                debate__round__silent=False,
                debate__round__completed=True,
            )
        elif table.private_url:
            debateadjs = debateadjs.filter(
                debate__round__draw_status=Round.STATUS_RELEASED)

        debates = [da.debate for da in debateadjs]
        populate_wins(debates)
        populate_confirmed_ballots(debates, motions=True, results=True)

        table.add_round_column([debate.round for debate in debates])
        table.add_debate_results_columns(debates)
        table.add_debate_adjudicators_column(debates,
                                             show_splits=True,
                                             highlight_adj=participant)

        if table.admin or view.tournament.pref('public_motions'):
            table.add_debate_motion_column(debates)

        table.add_debate_ballot_link_column(debates)
        return table