コード例 #1
0
ファイル: simulaterounds.py プロジェクト: modale/tabbycat
    def handle_round(self, round, **options):
        self.stdout.write("Deleting all debates in round '{}'...".format(
            round.name))
        Debate.objects.filter(round=round).delete()
        round.draw_status = Round.STATUS_NONE
        round.save()

        self.stdout.write(
            "Checking in all teams, adjudicators and venues for round '{}'...".
            format(round.name))
        activate_all(round)

        self.stdout.write("Generating a draw for round '{}'...".format(
            round.name))
        DrawManager(round).create()
        allocate_venues(round)
        round.draw_status = Round.STATUS_CONFIRMED
        round.save()

        self.stdout.write(
            "Auto-allocating adjudicators for round '{}'...".format(
                round.name))
        allocate_adjudicators(round, HungarianAllocator)

        self.stdout.write("Generating results for round '{}'...".format(
            round.name))
        add_ballotsets_to_round(round, **self.ballotset_kwargs(options))

        round.tournament.current_round = round
        round.tournament.save()
コード例 #2
0
    def handle_round(self, round, **options):
        if options["clean"]:
            self.stdout.write(
                self.style.WARNING("Deleting all ballot sets for {}...".format(
                    round.name)))
            delete_all_ballotsets_for_round(round)

        try:
            if options["num_ballots"] is not None:
                self.stdout.write(
                    self.style.MIGRATE_HEADING(
                        "Generating ballot sets for {:d} randomly-chosen debates "
                        "in {}...".format(options["num_ballots"], round.name)))
                add_ballotsets_to_round_partial(
                    round, options["num_ballots"],
                    **self.ballotset_kwargs(options))
            else:
                self.stdout.write(
                    self.style.MIGRATE_HEADING(
                        "Generating ballot sets for all debates in {}...".
                        format(round.name)))
                add_ballotsets_to_round(round,
                                        **self.ballotset_kwargs(options))

        except ValueError as e:
            raise CommandError(e)
        except DebateAdjudicator.DoesNotExist as e:
            raise CommandError(
                str(e) +
                " (Have you done adjudicator allocations for this round?)")
コード例 #3
0
ファイル: generateresults.py プロジェクト: jzbahrai/tabbycat
    def handle_round(self, round, **options):
        if options["clean"]:
            self.stdout.write(self.style.WARNING("Deleting all ballot sets for {}...".format(round.name)))
            delete_all_ballotsets_for_round(round)

        try:
            if options["num_ballots"] is not None:
                self.stdout.write(self.style.MIGRATE_HEADING("Generating ballot sets for {:d} randomly-chosen debates in {}...".format(options["num_ballots"], round.name)))
                add_ballotsets_to_round_partial(round, options["num_ballots"], **self.ballotset_kwargs(options))
            else:
                self.stdout.write(self.style.MIGRATE_HEADING("Generating ballot sets for all debates in {}...".format(round.name)))
                add_ballotsets_to_round(round, **self.ballotset_kwargs(options))
        except ValueError as e:
            raise CommandError(e)
        except DebateAdjudicator.DoesNotExist as e:
            raise CommandError(str(e) + " (Have you done adjudicator allocations for this round?)")
コード例 #4
0
ファイル: simulaterounds.py プロジェクト: BenMusch/tabbycat
    def handle_round(self, round, **options):
        self.stdout.write("Deleting all debates in round '{}'...".format(round.name))
        Debate.objects.filter(round=round).delete()
        round.draw_status = Round.STATUS_NONE
        round.save()

        self.stdout.write("Checking in all teams, adjudicators and venues for round '{}'...".format(round.name))
        round.activate_all()

        self.stdout.write("Generating a draw for round '{}'...".format(round.name))
        DrawManager(round).create()
        allocate_venues(round)
        round.draw_status = Round.STATUS_CONFIRMED
        round.save()

        self.stdout.write("Auto-allocating adjudicators for round '{}'...".format(round.name))
        allocate_adjudicators(round, HungarianAllocator)

        self.stdout.write("Generating results for round '{}'...".format(round.name))
        add_ballotsets_to_round(round, **self.ballotset_kwargs(options))

        round.tournament.current_round = round
        round.tournament.save()