예제 #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')
        debates = [ts.debate_team.debate for ts in teamscores]

        populate_opponents([ts.debate_team for ts in teamscores])

        for pos in [DebateTeam.POSITION_AFFIRMATIVE, DebateTeam.POSITION_NEGATIVE]:
            debates_for_pos = [ts.debate_team.debate for ts in teamscores if ts.debate_team.position == pos]
            populate_confirmed_ballots(debates_for_pos, motions=True)

        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_columns(teamscores)
        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_motion_column([debate.confirmed_ballot.motion
                if debate.confirmed_ballot else None for debate in debates])

        return table
예제 #2
0
파일: views.py 프로젝트: modale/tabbycat
    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')
        debates = [ts.debate_team.debate for ts in teamscores]

        populate_opponents([ts.debate_team for ts in teamscores])

        for pos in [DebateTeam.POSITION_AFFIRMATIVE, DebateTeam.POSITION_NEGATIVE]:
            debates_for_pos = [ts.debate_team.debate for ts in teamscores if ts.debate_team.position == pos]
            populate_confirmed_ballots(debates_for_pos, motions=True)

        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_columns(teamscores)
        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_motion_column([debate.confirmed_ballot.motion
                if debate.confirmed_ballot else None for debate in debates])

        return table
예제 #3
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
예제 #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
예제 #5
0
    def get_table(self):
        """On team record pages, the table is the results table."""
        tournament = self.get_tournament()
        teamscores = TeamScore.objects.filter(debate_team__team=self.object,
                ballot_submission__confirmed=True,
                debate_team__debate__round__seq__lt=tournament.current_round.seq,
                debate_team__debate__round__draw_status=Round.STATUS_RELEASED,
                debate_team__debate__round__silent=False).select_related(
                'debate_team__debate', 'debate_team__debate__round').prefetch_related(
                'debate_team__debate__debateadjudicator_set__adjudicator')
        debates = [ts.debate_team.debate for ts in teamscores]
        populate_opponents([ts.debate_team for ts in teamscores])
        populate_confirmed_ballots(debates, motions=True, ballotsets=True)

        table = TabbycatTableBuilder(view=self, title="Results", sort_key="Round")
        table.add_round_column([debate.round for debate in debates])
        table.add_debate_result_by_team_columns(teamscores)
        table.add_debate_adjudicators_column(debates, show_splits=True)

        if self.admin or tournament.pref('public_motions'):
            table.add_motion_column([debate.confirmed_ballot.motion
                if debate.confirmed_ballot else None for debate in debates])

        table.add_debate_ballot_link_column(debates)

        return table
예제 #6
0
    def get_table(self):
        """On adjudicator record pages, the table is the previous debates table."""
        tournament = self.get_tournament()
        debateadjs = DebateAdjudicator.objects.filter(adjudicator=self.object,
                debate__round__seq__lt=tournament.current_round.seq,
                debate__round__draw_status=Round.STATUS_RELEASED,
                debate__round__silent=False).select_related(
                'debate', 'debate__round').prefetch_related(
                'debate__debateadjudicator_set', 'debate__debateadjudicator_set__adjudicator')
        debates = [da.debate for da in debateadjs]
        populate_teams(debates)
        populate_wins(debates)
        populate_confirmed_ballots(debates, motions=True, ballotsets=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 tournament.pref('public_motions'):
            table.add_motion_column([debate.confirmed_ballot.motion
                if debate.confirmed_ballot else None for debate in debates])

        table.add_debate_ballot_link_column(debates)
        return table
예제 #7
0
파일: views.py 프로젝트: czlee/tabbycat
    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
예제 #8
0
파일: views.py 프로젝트: czlee/tabbycat
    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
예제 #9
0
파일: views.py 프로젝트: modale/tabbycat
    def get_table_by_debate(self):
        round = self.get_round()
        tournament = self.get_tournament()
        debates = round.debate_set_with_prefetches(ballotsets=True, wins=True)

        table = TabbycatTableBuilder(view=self, sort_key="Venue")
        table.add_debate_venue_columns(debates)
        table.add_debate_results_columns(debates)
        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_motion_column([d.confirmed_ballot.motion
                if d.confirmed_ballot else None for d in debates])

        return table
예제 #10
0
    def get_table_by_debate(self):
        round = self.get_round()
        tournament = self.get_tournament()
        debates = round.debate_set_with_prefetches(ballotsets=True, wins=True)

        table = TabbycatTableBuilder(view=self, sort_key="Venue")
        table.add_debate_venue_columns(debates)
        table.add_debate_results_columns(debates)
        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_motion_column([d.confirmed_ballot.motion
                if d.confirmed_ballot else None for d in debates])

        return table
예제 #11
0
파일: views.py 프로젝트: czlee/tabbycat
    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
예제 #12
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
예제 #13
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
예제 #14
0
    def get_table(self):
        """On team record pages, the table is the results table."""
        tournament = self.get_tournament()
        teamscores = TeamScore.objects.filter(
            debate_team__team=self.object,
            ballot_submission__confirmed=True,
            debate_team__debate__round__draw_status=Round.STATUS_RELEASED
        ).select_related('debate_team__debate__round').prefetch_related(
            Prefetch('debate_team__debate__debateadjudicator_set',
                     queryset=DebateAdjudicator.objects.select_related(
                         'adjudicator__institution')),
            'debate_team__debate__debateteam_set')
        if not tournament.pref('all_results_released'):
            teamscores = teamscores.filter(
                debate_team__debate__round__silent=False,
                debate_team__debate__round__seq__lt=tournament.current_round.
                seq)
        debates = [ts.debate_team.debate for ts in teamscores]
        populate_opponents([ts.debate_team for ts in teamscores])
        populate_confirmed_ballots(debates, motions=True, ballotsets=True)

        table = TabbycatTableBuilder(view=self,
                                     title="Results",
                                     sort_key="Round")
        table.add_round_column([debate.round for debate in debates])
        table.add_debate_result_by_team_columns(teamscores)
        table.add_debate_adjudicators_column(debates, show_splits=True)

        if self.admin or tournament.pref('public_motions'):
            table.add_motion_column([
                debate.confirmed_ballot.motion
                if debate.confirmed_ballot else None for debate in debates
            ])

        table.add_debate_ballot_link_column(debates)

        return table