Beispiel #1
0
    def get_table(self):
        if not self.is_draw_released():
            return None

        debateadjs = DebateAdjudicator.objects.filter(
            debate__round=self.tournament.current_round, ).select_related(
                'adjudicator',
                'debate__venue',
            ).prefetch_related('debate__venue__venuecategory_set', ).order_by(
                'adjudicator__name')

        table = TabbycatTableBuilder(view=self, sort_key='adj')

        data = [{
            'text':
            _("Add result from %(adjudicator)s") % {
                'adjudicator': da.adjudicator.name
            },
            'link':
            reverse_tournament('results-public-ballotset-new-pk',
                               self.tournament,
                               kwargs={'adj_id': da.adjudicator.id}),
        } for da in debateadjs]
        header = {'key': 'adj', 'title': _("Adjudicator")}
        table.add_column(header, data)

        debates = [da.debate for da in debateadjs]
        table.add_debate_venue_columns(debates)
        return table
Beispiel #2
0
    def get_table(self):
        if not self.is_draw_released():
            return None

        debateadjs = DebateAdjudicator.objects.filter(
            debate__round=self.tournament.current_round,
        ).select_related(
            'adjudicator', 'debate__venue',
        ).prefetch_related(
            'debate__venue__venuecategory_set',
        ).order_by('adjudicator__name')

        table = TabbycatTableBuilder(view=self, sort_key='adj')

        data = [{
            'text': _("Add result from %(adjudicator)s") % {'adjudicator': da.adjudicator.name},
            'link': reverse_tournament('results-public-ballotset-new-pk', self.tournament,
                    kwargs={'adj_id': da.adjudicator.id}),
        } for da in debateadjs]
        header = {'key': 'adj', 'title': _("Adjudicator")}
        table.add_column(header, data)

        debates = [da.debate for da in debateadjs]
        table.add_debate_venue_columns(debates)
        return table
Beispiel #3
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
Beispiel #4
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
Beispiel #5
0
    def get_table(self):
        r = self.get_round()
        tournament = self.get_tournament()
        table = TabbycatTableBuilder(view=self)
        if r.draw_status == r.STATUS_NONE:
            return table  # Return Blank

        draw = r.debate_set_with_prefetches(ordering=('room_rank', ),
                                            institutions=True,
                                            venues=True)
        populate_history(draw)
        if r.is_break_round:
            table.add_room_rank_columns(draw)
        else:
            table.add_debate_bracket_columns(draw)

        table.add_debate_venue_columns(draw, for_admin=True)
        table.add_team_columns([d.aff_team for d in draw],
                               key=aff_name(tournament).capitalize(),
                               hide_institution=True)
        table.add_team_columns([d.neg_team for d in draw],
                               key=neg_name(tournament).capitalize(),
                               hide_institution=True)

        # For draw details and draw draft pages
        if (r.draw_status == r.STATUS_DRAFT or self.detailed) and r.prev:
            teams = Team.objects.filter(debateteam__debate__round=r)
            metrics = r.tournament.pref('team_standings_precedence')
            generator = TeamStandingsGenerator(metrics, ('rank', 'subrank'))
            standings = generator.generate(teams, round=r.prev)
            if not r.is_break_round:
                table.add_debate_ranking_columns(draw, standings)
            else:
                self._add_break_rank_columns(table, draw, r.break_category)
            table.add_debate_metric_columns(draw, standings)
            table.add_sides_count([d.aff_team for d in draw], r.prev, 'aff')
            table.add_sides_count([d.neg_team for d in draw], r.prev, 'neg')
        else:
            table.add_debate_adjudicators_column(draw, show_splits=False)

        table.add_draw_conflicts_columns(draw)
        if not r.is_break_round:
            table.highlight_rows_by_column_value(
                column=0)  # highlight first row of a new bracket

        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_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 #8
0
    def get_table(self):
        r = self.get_round()
        table = TabbycatTableBuilder(view=self)
        if r.draw_status == r.STATUS_NONE:
            return table # Return Blank

        draw = r.debate_set_with_prefetches(ordering=('room_rank',), institutions=True)
        populate_history(draw)
        if r.is_break_round:
            table.add_room_rank_columns(draw)
        else:
            table.add_debate_bracket_columns(draw)

        table.add_debate_venue_columns(draw)
        table.add_team_columns([d.aff_team for d in draw], key="Aff",
            hide_institution=True)
        table.add_team_columns([d.neg_team for d in draw], key="Neg",
            hide_institution=True)

        # For draw details and draw draft pages
        if (r.draw_status == r.STATUS_DRAFT or self.detailed) and r.prev:
            teams = Team.objects.filter(debateteam__debate__round=r)
            metrics = r.tournament.pref('team_standings_precedence')
            generator = TeamStandingsGenerator(metrics, ('rank', 'subrank'))
            standings = generator.generate(teams, round=r.prev)
            if not r.is_break_round:
                table.add_debate_ranking_columns(draw, standings)
            else:
                table.add_column(
                    {'tooltip': "Affirmative Team's Break Rank", 'text': "ABR"},
                    ["%s" % d.aff_team.break_rank_for_category(r.break_category) for d in draw])
                table.add_column(
                    {'tooltip': "Negative Team's Break Rank", 'text': "NBR"},
                    ["%s" % d.neg_team.break_rank_for_category(r.break_category) for d in draw])
            table.add_debate_metric_columns(draw, standings)
            table.add_sides_count([d.aff_team for d in draw], r.prev, 'aff')
            table.add_sides_count([d.neg_team for d in draw], r.prev, 'neg')
        else:
            table.add_debate_adjudicators_column(draw, show_splits=False)

        table.add_draw_conflicts_columns(draw)
        if not r.is_break_round:
            table.highlight_rows_by_column_value(column=0) # highlight first row of a new bracket

        return table