示例#1
0
文件: views.py 项目: czlee/tabbycat
    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
示例#2
0
文件: views.py 项目: czlee/tabbycat
    def get_tables(self):
        tournament = self.tournament

        teams = tournament.team_set.all().annotate(feedback_count=Count('debateteam__adjudicatorfeedback')).prefetch_related('speaker_set')
        team_table = TabbycatTableBuilder(
            view=self, title=_('From Teams'), sort_key='team')
        team_table.add_team_columns(teams)
        team_feedback_data = []
        for team in teams:
            count = team.feedback_count
            team_feedback_data.append({
                'text': ngettext("%(count)d feedback", "%(count)d feedbacks", count) % {'count': count},
                'link': reverse_tournament('adjfeedback-view-from-team',
                                           tournament,
                                           kwargs={'pk': team.id}),
            })
        team_table.add_column({'key': 'feedbacks', 'title': _("Feedbacks")}, team_feedback_data)

        adjs = tournament.adjudicator_set.all().annotate(feedback_count=Count('debateadjudicator__adjudicatorfeedback'))
        adj_table = TabbycatTableBuilder(
            view=self, title=_('From Adjudicators'), sort_key='name')
        adj_table.add_adjudicator_columns(adjs)
        adj_feedback_data = []
        for adj in adjs:
            count = adj.feedback_count
            adj_feedback_data.append({
                'text': ngettext("%(count)d feedback", "%(count)d feedbacks", count) % {'count': count},
                'link': reverse_tournament('adjfeedback-view-from-adjudicator',
                                           tournament,
                                           kwargs={'pk': adj.id}),
            })
        adj_table.add_column({'key': 'feedbacks', 'title': _("Feedbacks")}, adj_feedback_data)

        return [team_table, adj_table]
示例#3
0
文件: views.py 项目: vicbab/tabbycat
    def get_speakers_table(self):
        speakers = Speaker.objects.filter(team__tournament=self.tournament)
        table = TabbycatTableBuilder(view=self, title=_("Speakers"), sort_key="name")
        table.add_speaker_columns(speakers, categories=False)
        self.add_url_columns(table, speakers, self.request)

        return table
示例#4
0
文件: views.py 项目: vicbab/tabbycat
    def get_tables(self):
        adjudicators = self.tournament.adjudicator_set.select_related(
            'institution')
        adjs_table = TabbycatTableBuilder(view=self,
                                          title=_("Adjudicators"),
                                          sort_key="name")
        adjs_table.add_adjudicator_columns(adjudicators)

        speakers = Speaker.objects.filter(
            team__tournament=self.tournament).select_related(
                'team',
                'team__institution').prefetch_related('team__speaker_set',
                                                      'categories')
        if use_team_code_names(self.tournament, self.admin):
            speakers = speakers.order_by('team__code_name')
        else:
            speakers = speakers.order_by('team__short_name')
        speakers_table = TabbycatTableBuilder(view=self,
                                              title=_("Speakers"),
                                              sort_key="team",
                                              admin=self.admin)
        speakers_table.add_speaker_columns(speakers)
        speakers_table.add_team_columns([speaker.team for speaker in speakers])

        return [adjs_table, speakers_table]
示例#5
0
    def get_tables(self):
        tables = []

        # notifications.sentmessage_set.first().emailstatus_set.first().latest_statuses will be a list
        notifications = self.tournament.bulknotification_set.select_related(
            'round',
        ).prefetch_related(Prefetch(
            'sentmessage_set',
            queryset=SentMessage.objects.select_related(
                'recipient',
            ).prefetch_related(Prefetch(
                'emailstatus_set',
                queryset=EmailStatus.objects.order_by('-timestamp'),
                to_attr='statuses',
            )),
        ))

        for notification in notifications:

            if notification.round is not None:
                subtitle = notification.round.name
            else:
                subtitle = _("@ %s") % formats.time_format(timezone.localtime(notification.timestamp), use_l10n=True)

            table = TabbycatTableBuilder(view=self, title=notification.get_event_display().capitalize(), subtitle=subtitle)

            emails_recipient = []
            emails_addresses = []
            emails_status = []
            emails_time = []

            for sentmessage in notification.sentmessage_set.all():
                emails_recipient.append(sentmessage.recipient.name if sentmessage.recipient else self.UNKNOWN_RECIPIENT_CELL)
                emails_addresses.append(sentmessage.email or self.UNKNOWN_RECIPIENT_CELL)

                if len(sentmessage.statuses) > 0:
                    latest_status = sentmessage.statuses[0]  # already ordered
                    status_cell = {
                        "text": latest_status.get_event_display(),
                        "class": self._get_event_class(latest_status.event),
                        "popover": {
                            "title": _("Timeline"),
                            "content": self._create_status_timeline(sentmessage.statuses),
                        },
                    }
                    emails_status.append(status_cell)
                    emails_time.append(formats.time_format(timezone.localtime(latest_status.timestamp), use_l10n=True))
                else:
                    emails_status.append(self.NA_CELL)
                    emails_time.append(self.NA_CELL)

            table.add_column({'key': 'name', 'tooltip': _("Participant"), 'icon': 'user'}, emails_recipient)
            table.add_column({'key': 'email', 'tooltip': _("Email address"), 'icon': 'mail'}, emails_addresses)
            table.add_column({'key': 'name', 'title': _("Status")}, emails_status)
            table.add_column({'key': 'name', 'title': _("Time")}, emails_time)

            tables.append(table)

        return tables
示例#6
0
文件: views.py 项目: vicbab/tabbycat
    def get_adjudicators_table(self):
        tournament = self.tournament

        adjudicators = Adjudicator.objects.all() if tournament.pref('share_adjs') else Adjudicator.objects.filter(tournament=tournament)
        table = TabbycatTableBuilder(view=self, title=_("Adjudicators"), sort_key="name")
        table.add_adjudicator_columns(adjudicators, show_institutions=False, show_metadata=False)
        self.add_url_columns(table, adjudicators, self.request)

        return table
示例#7
0
 def get_table(self):
     self.standings = self.get_standings()
     table = TabbycatTableBuilder(view=self, title=self.object.name, sort_key='Rk')
     table.add_ranking_columns(self.standings)
     table.add_column({'title': _("Break"), 'key': 'break'},
                      [tsi.break_rank for tsi in self.standings])
     table.add_team_columns([tsi.team for tsi in self.standings])
     table.add_metric_columns(self.standings)
     return table
示例#8
0
文件: views.py 项目: czlee/tabbycat
 def get_table(self):
     t = self.tournament
     teams = t.team_set.select_related('institution').prefetch_related('speaker_set')
     table = TabbycatTableBuilder(view=self, sort_key='code_name')
     table.add_column(
         {'key': 'code_name', 'title': _("Code name")},
         [{'text': t.code_name or "—"} for t in teams]
     )
     table.add_team_columns(teams)
     return table
示例#9
0
文件: views.py 项目: modale/tabbycat
    def get_table(self):
        tournament = self.get_tournament()

        # Find the most recent non-silent preliminary round
        round = tournament.current_round if tournament.pref(
            'all_results_released') else tournament.current_round.prev
        while round is not None and (round.silent or
                                     round.stage != Round.STAGE_PRELIMINARY):
            round = round.prev

        if round is None or round.silent:
            return TabbycatTableBuilder()  # empty (as precaution)

        teams = tournament.team_set.prefetch_related('speaker_set').order_by(
            'institution__code', 'reference'
        )  # Obscure true rankings, in case client disabled JavaScript
        rounds = tournament.prelim_rounds(until=round).filter(
            silent=False).order_by('seq')

        add_team_round_results_public(teams, rounds)

        # pre-sort, as Vue tables can't do two sort keys
        teams = sorted(teams, key=lambda t: (-t.wins, t.short_name))

        table = TabbycatTableBuilder(view=self, sort_order='desc')
        table.add_team_columns(teams)
        table.add_column("Wins", [team.wins for team in teams])
        table.add_team_results_columns(teams, rounds)

        messages.info(
            self.request, "This list is sorted by wins, and then by "
            "team name within each group — it does not indicate each team's "
            "ranking within each group.")

        return table
示例#10
0
    def get_table(self):
        rounds = self.get_rounds()
        if not rounds:
            return TabbycatTableBuilder(view=self)  # empty (as precaution)

        name_attr = 'code_name' if use_team_code_names(self.tournament,
                                                       False) else 'short_name'

        # Obscure true rankings, in case client disabled JavaScript
        teams = self.tournament.team_set.prefetch_related(
            'speaker_set').order_by(name_attr)

        # Can't use prefetch.populate_win_counts, since that doesn't exclude
        # silent rounds and future rounds appropriately
        opponents = self.tournament.pref('teams_in_debate') == 'two'
        add_team_round_results_public(teams, rounds, opponents=opponents)

        # Pre-sort, as Vue tables can't do two sort keys
        teams = sorted(teams, key=lambda t: (-t.points, getattr(t, name_attr)))
        key, title = ('points', _("Points")) if self.tournament.pref(
            'teams_in_debate') == 'bp' else ('wins', _("Wins"))
        header = {'key': key, 'tooltip': title, 'icon': 'bar-chart'}

        table = TabbycatTableBuilder(view=self, sort_order='desc')
        table.add_team_columns(teams)
        table.add_column(header, [team.points for team in teams])
        table.add_team_results_columns(teams, rounds)

        return table
示例#11
0
    def get_table(self):
        tournament = self.get_tournament()

        # Find the most recent non-silent preliminary round
        round = tournament.current_round if tournament.pref(
            'all_results_released') else tournament.current_round.prev
        while round is not None and (round.silent or
                                     round.stage != Round.STAGE_PRELIMINARY):
            round = round.prev

        if round is None or round.silent:
            return TabbycatTableBuilder()  # empty (as precaution)

        teams = tournament.team_set.prefetch_related('speaker_set').order_by(
            'institution__code', 'reference'
        )  # Obscure true rankings, in case client disabled JavaScript
        rounds = tournament.prelim_rounds(until=round).filter(
            silent=False).order_by('seq')

        # Can't use prefetch.populate_win_counts, since that doesn't exclude
        # silent rounds and future rounds appropriately
        add_team_round_results_public(teams, rounds)

        # Pre-sort, as Vue tables can't do two sort keys
        teams = sorted(teams, key=lambda t: (-t.points, t.short_name))
        measure = _("Points") if tournament.pref(
            'teams_in_debate') == 'bp' else _("Wins")

        table = TabbycatTableBuilder(view=self, sort_order='desc')
        table.add_team_columns(teams)
        table.add_column(measure, [team.points for team in teams])
        table.add_team_results_columns(teams, rounds)

        return table
示例#12
0
文件: views.py 项目: tfpk/tabbycat
    def get_table(self):
        tournament = self.get_tournament()

        teams = tournament.team_set.prefetch_related('speaker_set').order_by(
            'institution__code', 'reference'
        )  # Obscure true rankings, in case client disabled JavaScript
        rounds = self.get_rounds()

        if not rounds:
            return TabbycatTableBuilder(view=self)  # empty (as precaution)

        # Can't use prefetch.populate_win_counts, since that doesn't exclude
        # silent rounds and future rounds appropriately
        add_team_round_results_public(teams, rounds)

        # Pre-sort, as Vue tables can't do two sort keys
        teams = sorted(teams, key=lambda t: (-t.points, t.short_name))
        measure = _("Points") if tournament.pref(
            'teams_in_debate') == 'bp' else _("Wins")

        table = TabbycatTableBuilder(view=self, sort_order='desc')
        table.add_team_columns(teams)
        table.add_column(measure, [team.points for team in teams])
        table.add_team_results_columns(teams, rounds)

        return table
示例#13
0
 def get_table(self):
     self.standings = self.get_standings()
     table = TabbycatTableBuilder(view=self, title=self.object.name, sort_key='Rk')
     table.add_ranking_columns(self.standings)
     table.add_column("Break", [tsi.break_rank for tsi in self.standings])
     table.add_team_columns([tsi.team for tsi in self.standings])
     table.add_metric_columns(self.standings)
     return table
示例#14
0
文件: views.py 项目: czlee/tabbycat
 def get_table(self):
     tournament = self.tournament
     table = TabbycatTableBuilder(view=self, sort_key="name")
     table.add_adjudicator_columns(tournament.adjudicator_set.all())
     feedback_data = []
     for adj in tournament.adjudicator_set.all().annotate(feedback_count=Count('adjudicatorfeedback')):
         count = adj.feedback_count
         feedback_data.append({
             'text': ngettext("%(count)d feedback", "%(count)d feedbacks", count) % {'count': count},
             'link': reverse_tournament('adjfeedback-view-on-adjudicator', tournament, kwargs={'pk': adj.id}),
         })
     table.add_column({'key': 'feedbacks', 'title': _("Feedbacks")}, feedback_data)
     return table
示例#15
0
 def get_table(self):
     tournament = self.get_tournament()
     table = TabbycatTableBuilder(view=self, sort_key="Name")
     table.add_adjudicator_columns(tournament.adjudicator_set.all())
     feedback_data = []
     for adj in tournament.adjudicator_set.all():
         count = adj.adjudicatorfeedback_set.count()
         feedback_data.append({
             'text': "{:d} Feedbacks".format(count),
             'link': reverse_tournament('adjfeedback-view-on-adjudicator', tournament, kwargs={'pk': adj.id}),
         })
     table.add_column("Feedbacks", feedback_data)
     return table
示例#16
0
    def get_table(self, mixed_participants=False):
        table = TabbycatTableBuilder(view=self, sort_key='name')

        queryset = self.get_queryset()
        default_send_queryset = self.get_default_send_queryset()

        table.add_column({'key': 'send', 'title': _("Send Email")}, [{
            'component': 'check-cell',
            'checked': self.default_send(p, default_send_queryset),
            'id': p.id,
            'name': 'recipients',
            'value': p.id,
            'noSave': True,
            'type': self.get_person_type(p, mixed=mixed_participants),
        } for p in queryset])

        table.add_column({'key': 'name', 'tooltip': _("Participant"), 'icon': 'user'}, [{
            'text': p.name,
            'class': 'no-wrap' if len(p.name) < 20 else '',
        } for p in queryset])

        table.add_column({'key': 'email', 'tooltip': _("Email address"), 'icon': 'mail'}, [{
            'text': p.email if p.email else _("Not Provided"),
            'class': 'small' if p.email else 'small text-warning',
        } for p in queryset])

        return table
示例#17
0
    def get_participant_table(self):
        tournament = self.tournament

        def _build_url(person):
            path = reverse_tournament('privateurls-person-index',
                                      tournament,
                                      kwargs={'url_key': person.url_key})
            return self.request.build_absolute_uri(path)

        people = self.get_participants_to_email()
        title = _("Participants who will be sent e-mails (%(n)s)") % {
            'n': people.count()
        }
        table = TabbycatTableBuilder(view=self, title=title, sort_key="name")
        table.add_column({
            'key': 'name',
            'title': _("Name")
        }, [p.name for p in people])
        table.add_column({
            'key': 'email',
            'title': _("Email")
        }, [p.email for p in people])
        table.add_column({
            'key': 'url',
            'title': _("Private URL")
        }, [_build_url(p) for p in people])

        return table
示例#18
0
    def get_adjudicators_table(self):
        tournament = self.get_tournament()

        def _build_url(adjudicator, url_name):
            if adjudicator.url_key is None:
                return {'text': _("no URL"), 'class': 'text-warning'}
            path = reverse_tournament(url_name,
                                      tournament,
                                      kwargs={'url_key': adjudicator.url_key})
            return {
                'text': self.request.build_absolute_uri(path),
                'class': 'small'
            }

        adjudicators = Adjudicator.objects.all() if tournament.pref(
            'share_adjs') else tournament.adjudicator_set.all()
        table = TabbycatTableBuilder(view=self,
                                     title=_("Adjudicators"),
                                     sort_key=_("Name"))
        table.add_adjudicator_columns(adjudicators,
                                      hide_institution=True,
                                      hide_metadata=True)
        table.add_column(_("Feedback URL"), [
            _build_url(adj,
                       'adjfeedback-public-add-from-adjudicator-randomised')
            for adj in adjudicators
        ])
        table.add_column(_("Ballot URL"), [
            _build_url(adj, 'results-public-ballotset-new-randomised')
            for adj in adjudicators
        ])

        return table
示例#19
0
文件: views.py 项目: modale/tabbycat
    def get_table(self):
        standings, rounds = self.get_standings()

        table = TabbycatTableBuilder(view=self, sort_key="Rk")
        table.add_ranking_columns(standings)
        table.add_team_columns(
            [info.team for info in standings],
            show_divisions=self.get_tournament().pref('enable_divisions'))

        table.add_standings_results_columns(standings, rounds,
                                            self.show_ballots())
        table.add_metric_columns(standings)

        return table
示例#20
0
    def get_table(self):
        standings, rounds = self.get_standings()

        table = TabbycatTableBuilder(view=self, sort_key="Rk")
        table.add_ranking_columns(standings)
        table.add_team_columns([info.team for info in standings],
            show_divisions=self.get_tournament().pref('enable_divisions'))

        table.add_standings_results_columns(standings, rounds, self.show_ballots())
        table.add_metric_columns(standings)

        return table
示例#21
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
示例#22
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

        table.add_ranking_columns(standings)
        table.add_team_columns([info.team for info in standings], show_break_categories=True)

        table.add_standings_results_columns(standings, rounds, self.show_ballots())
        table.add_metric_columns(standings, integer_score_columns=self.integer_score_columns(rounds))

        return table
示例#23
0
文件: views.py 项目: czlee/tabbycat
    def get_table(self):
        table = TabbycatTableBuilder(view=self, sort_key=self.sort_key)
        queryset = utils.annotate_availability(self.get_queryset(), self.round)
        self.annotate_checkins(queryset, self.tournament)

        table.add_column({'key': 'active', 'title': _("Active Now")}, [{
            'component': 'check-cell',
            'checked': inst.available,
            'sort': inst.available,
            'id': inst.id,
            'prev': inst.prev_available if self.round.prev else False,
            'checked_in': inst.checked_in,
            'type': 0,
        } for inst in queryset])

        if self.round.prev:
            title = _("Active in %(prev_round)s") % {'prev_round': self.round.prev.abbreviation}
            table.add_column({'key': 'active', 'title': title}, [{
                'sort': inst.prev_available,
                'icon': 'check' if inst.prev_available else ''
            } for inst in queryset])

        checked_in_header = {'key': "tournament", 'title': _('Checked-In')}
        checked_in_data = [{
            'sort': inst.checked_in, 'icon': inst.checked_icon, 'tooltip': inst.checked_tooltip,
        } for inst in queryset]
        table.add_column(checked_in_header, checked_in_data)

        self.add_description_columns(table, queryset)
        return table
示例#24
0
    def get_table(self):
        tournament = self.get_tournament()

        # Find the most recent non-silent preliminary round
        round = tournament.current_round if tournament.pref('all_results_released') else tournament.current_round.prev
        while round is not None and (round.silent or round.stage != Round.STAGE_PRELIMINARY):
            round = round.prev

        if round is None or round.silent:
            return TabbycatTableBuilder() # empty (as precaution)

        teams = tournament.team_set.prefetch_related('speaker_set').order_by(
                'institution__code', 'reference')  # Obscure true rankings, in case client disabled JavaScript
        rounds = tournament.prelim_rounds(until=round).filter(silent=False).order_by('seq')

        add_team_round_results_public(teams, rounds)

        # pre-sort, as Vue tables can't do two sort keys
        teams = sorted(teams, key=lambda t: (-t.wins, t.short_name))

        table = TabbycatTableBuilder(view=self, sort_order='desc')
        table.add_team_columns(teams)
        table.add_column("Wins", [team.wins for team in teams])
        table.add_team_results_columns(teams, rounds)

        messages.info(self.request, "This list is sorted by wins, and then by "
            "team name within each group — it does not indicate each team's "
            "ranking within each group.")

        return table
示例#25
0
文件: views.py 项目: czlee/tabbycat
    def get_tables(self):
        tournament = self.tournament

        use_code_names = use_team_code_names_data_entry(self.tournament, self.tabroom)
        teams_table = TabbycatTableBuilder(view=self, sort_key="team", title=_("A Team"))
        add_link_data = [{
            'text': team_name_for_data_entry(team, use_code_names),
            'link': self.get_from_team_link(team)
        } for team in tournament.team_set.all()]
        header = {'key': 'team', 'title': _("Team")}
        teams_table.add_column(header, add_link_data)

        if tournament.pref('show_team_institutions'):
            teams_table.add_column({
                'key': 'institution',
                'icon': 'home',
                'tooltip': _("Institution"),
            }, [team.institution.code if team.institution else TabbycatTableBuilder.BLANK_TEXT for team in tournament.team_set.all()])

        if tournament.pref('share_adjs'):
            adjudicators = Adjudicator.objects.filter(Q(tournament=tournament) | Q(tournament__isnull=True))
        else:
            adjudicators = tournament.adjudicator_set.all()

        adjs_table = TabbycatTableBuilder(view=self, sort_key="adjudicator", title=_("An Adjudicator"))
        if tournament.pref('share_adjs'):
            adjudicators = Adjudicator.objects.filter(Q(tournament=tournament) | Q(tournament__isnull=True))
        else:
            adjudicators = tournament.adjudicator_set.all()

        add_link_data = [{
            'text': adj.name,
            'link': self.get_from_adj_link(adj),
        } for adj in adjudicators]
        header = {'key': 'adjudicator', 'title': _("Adjudicator")}
        adjs_table.add_column(header, add_link_data)

        if tournament.pref('show_adjudicator_institutions'):
            adjs_table.add_column({
                'key': 'institution',
                'icon': 'home',
                'tooltip': _("Institution"),
            }, [adj.institution.code if adj.institution else TabbycatTableBuilder.BLANK_TEXT for adj in adjudicators])

        return [teams_table, adjs_table]
示例#26
0
文件: views.py 项目: czlee/tabbycat
    def get_table(self):
        rounds = self.get_rounds()
        if not rounds:
            return TabbycatTableBuilder(view=self) # empty (as precaution)

        name_attr = 'code_name' if use_team_code_names(self.tournament, False) else 'short_name'

        # Obscure true rankings, in case client disabled JavaScript
        teams = self.tournament.team_set.prefetch_related('speaker_set').order_by(name_attr)

        # Can't use prefetch.populate_win_counts, since that doesn't exclude
        # silent rounds and future rounds appropriately
        opponents = self.tournament.pref('teams_in_debate') == 'two'
        add_team_round_results_public(teams, rounds, opponents=opponents)

        # Pre-sort, as Vue tables can't do two sort keys
        teams = sorted(teams, key=lambda t: (-t.points, getattr(t, name_attr)))
        key, title = ('points', _("Points")) if self.tournament.pref('teams_in_debate') == 'bp' else ('wins', _("Wins"))
        header = {'key': key, 'tooltip': title, 'icon': 'bar-chart'}

        table = TabbycatTableBuilder(view=self, sort_order='desc')
        table.add_team_columns(teams)
        table.add_column(header, [team.points for team in teams])
        table.add_team_results_columns(teams, rounds)

        return table
示例#27
0
文件: views.py 项目: czlee/tabbycat
    def get_adjudicators_table(self):
        tournament = self.tournament

        def _build_url(adjudicator):
            if adjudicator.url_key is None:
                return {'text': _("no URL"), 'class': 'text-warning'}
            path = reverse_tournament('privateurls-person-index', tournament, kwargs={'url_key': adjudicator.url_key})
            return {'text': self.request.build_absolute_uri(path), 'class': 'small'}

        adjudicators = Adjudicator.objects.all() if tournament.pref('share_adjs') else Adjudicator.objects.filter(tournament=tournament)
        table = TabbycatTableBuilder(view=self, title=_("Adjudicators"), sort_key="name")
        table.add_adjudicator_columns(adjudicators, show_institutions=False, show_metadata=False)
        table.add_column(
            {'key': 'url', 'title': _("URL")},
            [_build_url(adj) for adj in adjudicators]
        )

        return table
示例#28
0
    def get_tables(self):
        t = self.get_tournament()

        adjudicators = t.adjudicator_set.select_related('institution')
        adjs_table = TabbycatTableBuilder(view=self,
                                          title="Adjudicators",
                                          sort_key="Name")
        adjs_table.add_adjudicator_columns(adjudicators)

        speakers = Speaker.objects.filter(team__tournament=t).select_related(
            'team', 'team__institution').prefetch_related('team__speaker_set')
        speakers_table = TabbycatTableBuilder(view=self,
                                              title="Speakers",
                                              sort_key="Name")
        speakers_table.add_speaker_columns(speakers)
        speakers_table.add_team_columns([speaker.team for speaker in speakers])

        return [adjs_table, speakers_table]
示例#29
0
文件: views.py 项目: modale/tabbycat
 def get_table(self):
     tournament = self.get_tournament()
     round = self.get_round()
     draw = self.get_draw()
     table = TabbycatTableBuilder(view=self,
                                  sort_key=self.sort_key,
                                  popovers=self.popovers)
     self.populate_table(draw, table, round, tournament)
     return table
示例#30
0
文件: views.py 项目: czlee/tabbycat
    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
示例#31
0
文件: views.py 项目: czlee/tabbycat
    def get_speakers_table(self):
        tournament = self.tournament

        def _build_url(speaker):
            if speaker.url_key is None:
                return {'text': _("no URL"), 'class': 'text-warning'}
            path = reverse_tournament('privateurls-person-index', tournament,
                kwargs={'url_key': speaker.url_key})
            return {'text': self.request.build_absolute_uri(path), 'class': 'small'}

        speakers = Speaker.objects.filter(team__tournament=tournament)
        table = TabbycatTableBuilder(view=self, title=_("Speakers"), sort_key="name")
        table.add_speaker_columns(speakers, categories=False)
        table.add_column(
            {'key': 'url', 'title': _("URL")},
            [_build_url(speaker) for speaker in speakers]
        )

        return table
示例#32
0
 def get_table(self):
     r = self.round
     if r.draw_status == Round.STATUS_NONE:
         return TabbycatTableBuilder(view=self)  # blank
     elif self.tournament.pref('teams_in_debate') == 'bp' and \
             r.draw_status == Round.STATUS_DRAFT and r.prev is not None and \
             not r.is_break_round:
         return self.get_bp_position_balance_table()
     else:
         return self.get_standard_table()
示例#33
0
文件: views.py 项目: czlee/tabbycat
    def get_table(self):
        round = self.get_round()
        table = TabbycatTableBuilder(view=self, sort_key=self.sort_key)

        queryset = utils.annotate_availability(self.get_queryset(), round)

        table.add_checkbox_columns([inst.available for inst in queryset], [inst.id for inst in queryset], "Active Now")

        if round.prev:
            table.add_column(
                "Active in %s" % round.prev.abbreviation,
                [
                    {"sort": inst.prev_available, "icon": "glyphicon-ok" if inst.prev_available else ""}
                    for inst in queryset
                ],
            )

        self.add_description_columns(table, queryset)
        return table
示例#34
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
示例#35
0
    def get_speakers_table(self):
        tournament = self.tournament

        def _build_url(speaker):
            if speaker.url_key is None:
                return {'text': _("no URL"), 'class': 'text-warning'}
            path = reverse_tournament('privateurls-person-index',
                                      tournament,
                                      kwargs={'url_key': speaker.url_key})
            return {
                'text': self.request.build_absolute_uri(path),
                'class': 'small'
            }

        speakers = Speaker.objects.filter(team__tournament=tournament)
        table = TabbycatTableBuilder(view=self,
                                     title=_("Speakers"),
                                     sort_key="name")
        table.add_speaker_columns(speakers, categories=False)
        table.add_column({
            'key': 'url',
            'title': _("URL")
        }, [_build_url(speaker) for speaker in speakers])

        return table
示例#36
0
    def get_tables(self):
        t = self.get_tournament()

        adjudicators = t.adjudicator_set.select_related('institution')
        adjs_table = TabbycatTableBuilder(view=self, title="Adjudicators", sort_key="Name")
        adjs_table.add_adjudicator_columns(adjudicators)

        speakers = Speaker.objects.filter(team__tournament=t).select_related(
                'team', 'team__institution').prefetch_related('team__speaker_set')
        speakers_table = TabbycatTableBuilder(view=self, title="Speakers", sort_key="Name")
        speakers_table.add_speaker_columns(speakers)
        speakers_table.add_team_columns([speaker.team for speaker in speakers])

        return [adjs_table, speakers_table]
示例#37
0
    def get_table(self):
        round = self.get_round()
        table = TabbycatTableBuilder(view=self, sort_key=self.sort_key)
        queryset = utils.annotate_availability(self.get_queryset(), round)

        table.add_column(
            _("Active Now"), [{
                'component': 'check-cell',
                'checked': inst.available,
                'sort': inst.available,
                'id': inst.id,
                'prev': inst.prev_available if round.prev else False,
                'type': 0,
            } for inst in queryset])

        if round.prev:
            table.add_column(
                _("Active in %(prev_round)s") %
                {'prev_round': round.prev.abbreviation},
                [{
                    'sort': inst.prev_available,
                    'icon': 'check' if inst.prev_available else ''
                } for inst in queryset])

        self.add_description_columns(table, queryset)
        return table
示例#38
0
    def get_adjudicators_table(self):
        tournament = self.tournament

        def _build_url(adjudicator):
            if adjudicator.url_key is None:
                return {'text': _("no URL"), 'class': 'text-warning'}
            path = reverse_tournament('privateurls-person-index',
                                      tournament,
                                      kwargs={'url_key': adjudicator.url_key})
            return {
                'text': self.request.build_absolute_uri(path),
                'class': 'small'
            }

        adjudicators = Adjudicator.objects.all() if tournament.pref(
            'share_adjs') else Adjudicator.objects.filter(
                tournament=tournament)
        table = TabbycatTableBuilder(view=self,
                                     title=_("Adjudicators"),
                                     sort_key="name")
        table.add_adjudicator_columns(adjudicators,
                                      show_institutions=False,
                                      show_metadata=False)
        table.add_column({
            'key': 'url',
            'title': _("URL")
        }, [_build_url(adj) for adj in adjudicators])

        return table
示例#39
0
    def get_table(self):
        t = self.tournament
        table = TabbycatTableBuilder(view=self, sort_key='team')
        teams = t.team_set.all().select_related(
            'institution').prefetch_related('break_categories', 'speaker_set')
        speaker_categories = t.speakercategory_set.order_by('seq')

        nspeaker_annotations = {}
        for sc in speaker_categories:
            nspeaker_annotations['nspeakers_%s' % sc.slug] = Count(
                'speaker', filter=Q(speaker__categories=sc))
        teams = teams.annotate(**nspeaker_annotations)

        table.add_team_columns(teams)

        break_categories = t.breakcategory_set.order_by('seq')
        for bc in break_categories:
            table.add_column({
                'title': bc.name,
                'key': bc.slug
            }, [{
                'component': 'check-cell',
                'checked':
                True if bc in team.break_categories.all() else False,
                'sort': True if bc in team.break_categories.all() else False,
                'id': team.id,
                'type': bc.id,
            } for team in teams])

        # Provide list of members within speaker categories for convenient entry
        for sc in speaker_categories:
            table.add_column(
                {
                    'title': _('%s Speakers') % sc.name,
                    'key': sc.name + "_speakers"
                }, [{
                    'text': getattr(team, 'nspeakers_%s' % sc.slug, 'N/A'),
                    'tooltip': ngettext(
                        'Team has %(nspeakers)s speaker with the %(category)s speaker category assigned',
                        'Team has %(nspeakers)s speakers with the %(category)s speaker category assigned',
                        getattr(team, 'nspeakers_%s' % sc.slug, 0),
                    ) % {
                        'nspeakers': getattr(team, 'nspeakers_%s' % sc.slug,
                                             'N/A'),
                        'category': sc.name
                    },
                } for team in teams])

        return table
示例#40
0
    def get_adjudicators_table(self, url_type, url_name, url_header):
        tournament = self.tournament

        def _build_url(adjudicator):
            path = reverse_tournament(url_name, tournament, kwargs={'url_key': adjudicator.url_key})
            return self.request.build_absolute_uri(path)

        adjudicators = self.get_adjudicators_to_email(url_type)
        title = _("Adjudicators who will be sent e-mails (%(n)s)") % {'n': adjudicators.count()}
        table = TabbycatTableBuilder(view=self, title=title, sort_key="name")
        table.add_adjudicator_columns(adjudicators, show_institutions=False, show_metadata=False)
        table.add_column({'key': 'email', 'title': _("Email")}, [adj.email for adj in adjudicators])
        table.add_column(url_header, [_build_url(adj) for adj in adjudicators])

        return table
示例#41
0
    def get_tables(self):
        tournament = self.get_tournament()

        teams = tournament.team_set.all()
        team_table = TabbycatTableBuilder(
            view=self, title='From Teams', sort_key='Name')
        team_table.add_team_columns(teams)
        team_feedback_data = []
        for team in teams:
            count = AdjudicatorFeedback.objects.filter(
                source_team__team=team).select_related(
                'source_team__team').count()
            team_feedback_data.append({
                'text': "{:d} Feedbacks".format(count),
                'link': reverse_tournament('adjfeedback-view-from-team',
                                           tournament,
                                           kwargs={'pk': team.id}),
            })
        team_table.add_column("Feedbacks", team_feedback_data)

        adjs = tournament.adjudicator_set.all()
        adj_table = TabbycatTableBuilder(
            view=self, title='From Adjudicators', sort_key='Feedbacks')
        adj_table.add_adjudicator_columns(adjs)
        adj_feedback_data = []
        for adj in adjs:
            count = AdjudicatorFeedback.objects.filter(
                source_adjudicator__adjudicator=adj).select_related(
                'source_adjudicator__adjudicator').count()
            adj_feedback_data.append({
                'text': "{:d} Feedbacks".format(count),
                'link': reverse_tournament('adjfeedback-view-from-adjudicator',
                                           tournament,
                                           kwargs={'pk': adj.id}),
            })
        adj_table.add_column("Feedbacks", adj_feedback_data)

        return [team_table, adj_table]
示例#42
0
    def get_tables(self):
        t = self.get_tournament()

        adjudicators = t.adjudicator_set.select_related('institution')
        adjs_table = TabbycatTableBuilder(view=self,
                                          title="Adjudicators",
                                          sort_key="Name")
        adjs_table.add_adjudicator_columns(adjudicators)

        teams = t.team_set.select_related('institution')
        teams_table = TabbycatTableBuilder(view=self,
                                           title="Teams",
                                           sort_key="Name")
        teams_table.add_team_columns(teams, key="Name")

        return [adjs_table, teams_table]
示例#43
0
    def get_table(self):
        table = TabbycatTableBuilder(view=self, sort_key='team')
        speakers = Speaker.objects.filter(team__tournament=self.tournament).select_related(
            'team', 'team__institution').prefetch_related('categories', 'team__speaker_set')
        table.add_speaker_columns(speakers, categories=False)
        table.add_team_columns([speaker.team for speaker in speakers])
        speaker_categories = self.tournament.speakercategory_set.all()

        for sc in speaker_categories:
            table.add_column({'key': sc.name, 'title': sc.name}, [{
                'component': 'check-cell',
                'checked': True if sc in speaker.categories.all() else False,
                'id': speaker.id,
                'type': sc.id,
            } for speaker in speakers])
        return table
示例#44
0
    def get_speakers_table(self):
        tournament = self.tournament

        def _build_url(speaker):
            path = reverse_tournament('adjfeedback-public-add-from-team-randomised', tournament,
                kwargs={'url_key': speaker.team.url_key})
            return self.request.build_absolute_uri(path)

        speakers = self.get_speakers_to_email()
        title = _("Speakers who will be sent e-mails (%(n)s)") % {'n': speakers.count()}
        table = TabbycatTableBuilder(view=self, title=title, sort_key="team")
        table.add_speaker_columns(speakers, categories=False)
        table.add_team_columns([speaker.team for speaker in speakers])
        table.add_column(
            {'key': 'title', 'title': _("Email")},
            [speaker.email for speaker in speakers]
        )
        table.add_column(
            {'key': 'feedback-url', 'title': _("Feedback URL")},
            [_build_url(speaker) for speaker in speakers]
        )

        return table
示例#45
0
文件: views.py 项目: czlee/tabbycat
    def get_tables(self):
        adjudicators = self.tournament.adjudicator_set.select_related('institution')
        adjs_table = TabbycatTableBuilder(view=self, title=_("Adjudicators"), sort_key="name")
        adjs_table.add_adjudicator_columns(adjudicators)

        speakers = Speaker.objects.filter(team__tournament=self.tournament).select_related(
                'team', 'team__institution').prefetch_related('team__speaker_set', 'categories')
        if use_team_code_names(self.tournament, self.admin):
            speakers = speakers.order_by('team__code_name')
        else:
            speakers = speakers.order_by('team__short_name')
        speakers_table = TabbycatTableBuilder(view=self, title=_("Speakers"),
                sort_key="team", admin=self.admin)
        speakers_table.add_speaker_columns(speakers)
        speakers_table.add_team_columns([speaker.team for speaker in speakers])

        return [adjs_table, speakers_table]
示例#46
0
 def get_table(self):
     t = self.tournament
     teams = t.team_set.select_related('institution').prefetch_related('speaker_set')
     table = TabbycatTableBuilder(view=self, sort_key='code_name')
     table.add_column(
         {'key': 'code_name', 'title': _("Code name")},
         [{'text': t.code_name or "—"} for t in teams],
     )
     table.add_team_columns(teams)
     return table
示例#47
0
文件: views.py 项目: czlee/tabbycat
    def get_participant_table(self):
        tournament = self.tournament

        def _build_url(person):
            path = reverse_tournament('privateurls-person-index', tournament, kwargs={'url_key': person.url_key})
            return self.request.build_absolute_uri(path)

        people = self.get_participants_to_email()
        title = _("Participants who will be sent e-mails (%(n)s)") % {'n': people.count()}
        table = TabbycatTableBuilder(view=self, title=title, sort_key="name")
        table.add_column({'key': 'name', 'title': _("Name")}, [p.name for p in people])
        table.add_column({'key': 'email', 'title': _("Email")}, [p.email for p in people])
        table.add_column({'key': 'url', 'title': _("Private URL")}, [_build_url(p) for p in people])

        return table
示例#48
0
    def get_tables(self):
        t = self.get_tournament()

        adjudicators = t.adjudicator_set.select_related('institution')
        adjs_table = TabbycatTableBuilder(view=self, title="Adjudicators", sort_key="Name")
        adjs_table.add_adjudicator_columns(adjudicators)

        teams = t.team_set.select_related('institution')
        teams_table = TabbycatTableBuilder(view=self, title="Teams", sort_key="Name")
        teams_table.add_team_columns(teams, key="Name")

        return [adjs_table, teams_table]
示例#49
0
文件: views.py 项目: czlee/tabbycat
    def get_table(self):
        table = TabbycatTableBuilder(view=self, sort_key='team')
        speakers = Speaker.objects.filter(team__tournament=self.tournament).select_related(
            'team', 'team__institution').prefetch_related('categories', 'team__speaker_set')
        table.add_speaker_columns(speakers, categories=False)
        table.add_team_columns([speaker.team for speaker in speakers])
        speaker_categories = self.tournament.speakercategory_set.all()

        for sc in speaker_categories:
            table.add_column({'key': sc.name, 'title': sc.name}, [{
                'component': 'check-cell',
                'checked': True if sc in speaker.categories.all() else False,
                'id': speaker.id,
                'type': sc.id
            } for speaker in speakers])
        return table
示例#50
0
 def get_table(self):
     tournament = self.tournament
     table = TabbycatTableBuilder(view=self, sort_key="name")
     table.add_adjudicator_columns(tournament.adjudicator_set.all())
     feedback_data = []
     for adj in tournament.adjudicator_set.all():
         count = adj.adjudicatorfeedback_set.count()
         feedback_data.append({
             'text': ngettext("%(count)d feedback", "%(count)d feedbacks", count) % {'count': count},
             'link': reverse_tournament('adjfeedback-view-on-adjudicator', tournament, kwargs={'pk': adj.id}),
         })
     table.add_column({'key': 'feedbacks', 'title': _("Feedbacks")}, feedback_data)
     return table
示例#51
0
    def get_table(self):
        table = TabbycatTableBuilder(view=self, sort_key=self.sort_key)
        queryset = utils.annotate_availability(self.get_queryset(), self.round)
        self.annotate_checkins(queryset, self.tournament)

        table.add_column({
            'key': 'active',
            'title': _("Active Now")
        }, [{
            'component': 'check-cell',
            'checked': inst.available,
            'sort': inst.available,
            'id': inst.id,
            'prev': inst.prev_available if self.round.prev else False,
            'checked_in': inst.checked_in,
            'type': 0,
        } for inst in queryset])

        if self.round.prev:
            title = _("Active in %(prev_round)s") % {
                'prev_round': self.round.prev.abbreviation
            }
            table.add_column({
                'key': 'active',
                'title': title
            }, [{
                'sort': inst.prev_available,
                'icon': 'check' if inst.prev_available else ''
            } for inst in queryset])

        checked_in_header = {'key': "tournament", 'title': _('Checked-In')}
        checked_in_data = [{
            'sort': inst.checked_in,
            'icon': inst.checked_icon,
            'tooltip': inst.checked_tooltip,
        } for inst in queryset]
        table.add_column(checked_in_header, checked_in_data)

        self.add_description_columns(table, queryset)
        return table
示例#52
0
    def get_table(self):
        t = self.tournament
        table = TabbycatTableBuilder(view=self, sort_key='team')
        teams = t.team_set.all().select_related(
            'institution').prefetch_related('break_categories', 'speaker_set')
        table.add_team_columns(teams)
        break_categories = t.breakcategory_set.all()

        for bc in break_categories:
            table.add_column({'title': bc.name, 'key': bc.name}, [{
                'component': 'check-cell',
                'checked': True if bc in team.break_categories.all() else False,
                'id': team.id,
                'type': bc.id
            } for team in teams])
        return table
示例#53
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
示例#54
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
示例#55
0
文件: views.py 项目: czlee/tabbycat
 def get_table(self):
     table = TabbycatTableBuilder(view=self, sort_key='name')
     table.add_adjudicator_columns(self.tournament.adjudicator_set.filter(breaking=True))
     return table
示例#56
0
    def get_table(self):
        motions = motion_statistics.statistics(round=self.get_round())
        table = TabbycatTableBuilder(view=self, sort_key="Order")

        table.add_round_column([motion.round for motion in motions])
        table.add_motion_column(motions, show_order=True)
        table.add_column("Selected", [motion.chosen_in for motion in motions])
        if self.get_tournament().pref('motion_vetoes_enabled'):
            table.add_column("Aff Vetoes", [motion.aff_vetoes for motion in motions])
            table.add_column("Neg Vetoes", [motion.neg_vetoes for motion in motions])
        table.add_column("Aff Wins", [motion.aff_wins for motion in motions])
        table.add_column("Neg Wins", [motion.neg_wins for motion in motions])
        return table
示例#57
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
示例#58
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