def import_categories(self): self.team_breaks = {} self.speaker_categories = {} for i, breakqual in enumerate(self.root.findall('break-category'), 1): bc = BreakCategory( tournament=self.tournament, name=breakqual.text, slug=slugify(breakqual.text[:50]), seq=i, break_size=0, is_general=False, priority=0, ) bc.save() self.team_breaks[breakqual.get('id')] = bc for i, category in enumerate(self.root.findall('speaker-category'), 1): sc = SpeakerCategory( tournament=self.tournament, name=category.text, slug=slugify(category.text[:50]), seq=i, ) sc.save() self.speaker_categories[category.get('id')] = sc
def save(self): tournament = super(TournamentForm, self).save() auto_make_rounds(tournament, self.cleaned_data["num_prelim_rounds"]) break_size = self.cleaned_data["break_size"] if break_size: open_break = BreakCategory( tournament=tournament, # Translators: This is the name given to the 'Open Break'. name=_("Open"), slug="open", seq=1, break_size=break_size, is_general=True, priority=100) open_break.full_clean() open_break.save() num_break_rounds = math.ceil(math.log2(break_size)) auto_make_break_rounds(tournament, num_break_rounds, open_break) self.add_default_feedback_questions(tournament) tournament.current_round = tournament.round_set.first() tournament.save() return tournament
def save(self): tournament = super(TournamentForm, self).save() auto_make_rounds(tournament, self.cleaned_data["num_prelim_rounds"]) break_size = self.cleaned_data["break_size"] if break_size: open_break = BreakCategory( tournament=tournament, name="Open", slug="open", seq=1, break_size=break_size, is_general=True, priority=100 ) open_break.full_clean() open_break.save() num_break_rounds = math.ceil(math.log2(break_size)) auto_make_break_rounds(tournament, num_break_rounds, open_break) tournament.current_round = tournament.round_set.first() tournament.save() return tournament
def save(self): tournament = super(TournamentStartForm, self).save() auto_make_rounds(tournament, self.cleaned_data["num_prelim_rounds"]) break_size = self.cleaned_data["break_size"] if break_size: open_break = BreakCategory( tournament=tournament, # Translators: This is the name given to the 'Open Break'. name=_("Open"), slug="open", seq=1, break_size=break_size, is_general=True, priority=100 ) open_break.full_clean() open_break.save() self.add_default_feedback_questions(tournament) tournament.current_round = tournament.round_set.order_by('seq').first() tournament.save() return tournament