def break_teams(request): if request.method == "POST": # Perform the break backup.backup_round("before_the_break_%s" % (timezone.now().strftime("%H:%M"), )) success, msg = outround_tab_logic.perform_the_break() if success: return redirect_and_flash_success(request, msg, path="/outround_pairing") return redirect_and_flash_error(request, msg, path="/") # See if we can pair the round title = "Pairing Outrounds" current_round_number = 0 previous_round_number = TabSettings.get("tot_rounds", 5) check_status = [] msg = "All Rounds properly entered for Round %s" % (previous_round_number) ready_to_pair = "Yes" ready_to_pair_alt = "Checks passed!" try: tab_logic.have_properly_entered_data(current_round_number) check_status.append((msg, "Yes", "All rounds look good")) except PrevRoundNotEnteredError as e: ready_to_pair = "No" ready_to_pair_alt = str(e) check_status.append( (msg, "No", "Not all rounds are entered. %s" % str(e))) except ByeAssignmentError as e: ready_to_pair = "No" ready_to_pair_alt = str(e) check_status.append( (msg, "No", "You have a bye and results. %s" % str(e))) except NoShowAssignmentError as e: ready_to_pair = "No" ready_to_pair_alt = str(e) check_status.append( (msg, "No", "You have a noshow and results. %s" % str(e))) rooms = outround_tab_logic.have_enough_rooms_before_break() msg = "N/2 Rooms available Round Out-rounds? Need {0}, have {1}".format( rooms[1][1], rooms[1][0]) if rooms[0]: check_status.append((msg, "Yes", "Rooms are checked in")) else: check_status.append((msg, "No", "Not enough rooms")) return render(request, "pairing/pair_round.html", locals())
def test_all_outrounds(self): self.generate_checkins() outround_tab_logic.perform_the_break() var_teams_to_break = TabSettings.get("var_teams_to_break", 8) while var_teams_to_break > 2: outround_tab_logic.pair(BreakingTeam.VARSITY) outrounds = Outround.objects.filter( type_of_round=BreakingTeam.VARSITY, num_teams=var_teams_to_break ) self.confirm_pairing( outrounds, var_teams_to_break ) self.enter_results(BreakingTeam.VARSITY) var_teams_to_break /= 2
def test_pairing(self): self.generate_checkins() outround_tab_logic.perform_the_break() outround_tab_logic.pair(BreakingTeam.NOVICE) outround_tab_logic.pair(BreakingTeam.VARSITY)
def test_break(self): self.generate_checkins() outround_tab_logic.perform_the_break()