Exemplo n.º 1
0
def assign_judges_to_pairing(request):
    current_round_number = TabSettings.objects.get(key="cur_round").value - 1
    if request.method == 'POST':
        panel_points, errors = [], []
        potential_panel_points = [k for k in list(request.POST.keys()) if k.startswith('panel_')]
        for point in potential_panel_points:
           try:
               point = int(point.split("_")[1])
               num = float(request.POST["panel_{0}".format(point)])
               if num > 0.0:
                   panel_points.append((Round.objects.get(id=point), num))
           except Exception as e:
               emit_current_exception()
               errors.append(e)
               pass

        panel_points.reverse()
        rounds = list(Round.objects.filter(round_number=current_round_number))
        judges = [ci.judge for ci in CheckIn.objects.filter(round_number=current_round_number)]
        try:
            backup.backup_round("round_%s_before_judge_assignment" % current_round_number)
            assign_judges.add_judges(rounds, judges, panel_points)
        except Exception as e:
            emit_current_exception()
            return redirect_and_flash_error(request,
                    "Got error during judge assignment")
    return redirect('/pairings/status/')
Exemplo n.º 2
0
def assign_judges_to_pairing(request):
    current_round_number = TabSettings.objects.get(key="cur_round").value - 1
    if request.method == 'POST':
        print "Assigning judges"
        print request.POST
        panel_points, errors = [], []
        potential_panel_points = [k for k in request.POST.keys() if k.startswith('panel_')]
        for point in potential_panel_points:
           try:
               point = int(point.split("_")[1])
               num = float(request.POST["panel_{0}".format(point)])
               if num > 0.0:
                   panel_points.append((Round.objects.get(id=point), num))
           except Exception as e:
               errors.append(e)
               pass

        panel_points.reverse()
        rounds = list(Round.objects.filter(round_number=current_round_number))
        judges = [ci.judge for ci in CheckIn.objects.filter(round_number=current_round_number)]
        try:
            assign_judges.add_judges(rounds, judges, panel_points)
        except Exception as e:
            return render_to_response('error.html',
                                     {'error_type': "Judge Assignment",
                                      'error_name': "",
                                      'error_info': str(e)},
                                      context_instance=RequestContext(request))
        return view_round(request, current_round_number)
    else:
        return view_round(request, current_round_number)
Exemplo n.º 3
0
def assign_judges_to_pairing(request):
    current_round_number = TabSettings.objects.get(key="cur_round").value - 1
    if request.method == 'POST':
        print "Assigning judges"
        print request.POST
        panel_points, errors = [], []
        potential_panel_points = [k for k in request.POST.keys() if k.startswith('panel_')]
        for point in potential_panel_points:
           try:
               point = int(point.split("_")[1])
               num = float(request.POST["panel_{0}".format(point)])
               if num > 0.0:
                   panel_points.append((Round.objects.get(id=point), num))
           except Exception as e:
               errors.append(e)
               pass

        panel_points.reverse()
        rounds = list(Round.objects.filter(round_number=current_round_number))
        judges = [ci.judge for ci in CheckIn.objects.filter(round_number=current_round_number)]
        try:
            assign_judges.add_judges(rounds, judges, panel_points)
        except Exception as e:
            return render_to_response('error.html',
                                     {'error_type': "Judge Assignment",
                                      'error_name': "",
                                      'error_info': str(e)},
                                      context_instance=RequestContext(request))
        return view_round(request, current_round_number)
    else:
        return view_round(request, current_round_number)
Exemplo n.º 4
0
def assign_judges_to_pairing(request):
    current_round_number = TabSettings.objects.get(key="cur_round").value - 1
    if request.method == "POST":
        panel_points, errors = [], []
        potential_panel_points = [
            k for k in list(request.POST.keys()) if k.startswith("panel_")
        ]
        for point in potential_panel_points:
            try:
                point = int(point.split("_")[1])
                num = float(request.POST["panel_{0}".format(point)])
                if num > 0.0:
                    panel_points.append((Round.objects.get(id=point), num))
            except Exception as e:
                emit_current_exception()
                errors.append(e)

        panel_points.reverse()
        rounds = list(Round.objects.filter(round_number=current_round_number))
        judges = [
            ci.judge
            for ci in CheckIn.objects.filter(round_number=current_round_number)
        ]
        try:
            backup.backup_round("round_%s_before_judge_assignment" %
                                current_round_number)
            assign_judges.add_judges(rounds, judges, panel_points)
        except Exception as e:
            emit_current_exception()
            return redirect_and_flash_error(
                request, "Got error during judge assignment")
    return redirect("/pairings/status/")
Exemplo n.º 5
0
 def assign_judges(self):
     cur_round = self.round_number()
     panel_points = []
     rounds = list(Round.objects.filter(round_number=cur_round))
     self.generate_checkins()
     judges = [ci.judge for ci in CheckIn.objects.filter(round_number=cur_round)]
     print len(rounds), len(judges)
     assign_judges.add_judges(rounds, judges, panel_points)
Exemplo n.º 6
0
 def assign_judges(self):
     cur_round = self.round_number()
     panel_points = []
     rounds = list(Round.objects.filter(round_number=cur_round))
     self.generate_checkins()
     judges = [
         ci.judge for ci in CheckIn.objects.filter(round_number=cur_round)
     ]
     assign_judges.add_judges(rounds, judges, panel_points)
Exemplo n.º 7
0
def assign_judges_to_pairing(request):
    current_round_number = TabSettings.objects.get(key="cur_round").value - 1
    if request.method == 'POST':
        panel_points, errors = [], []
        potential_panel_points = [
            k for k in list(request.POST.keys()) if k.startswith('panel_')
        ]
        for point in potential_panel_points:
            try:
                point = int(point.split("_")[1])
                num = float(request.POST["panel_{0}".format(point)])
                if num > 0.0:
                    panel_points.append((Round.objects.get(id=point), num))
            except Exception as e:
                emit_current_exception()
                errors.append(e)
                pass

        panel_points.reverse()
        rounds = list(Round.objects.filter(round_number=current_round_number))
        judges = [
            ci.judge
            for ci in CheckIn.objects.filter(round_number=current_round_number)
        ]
        try:
            backup.backup_round("round_%s_before_judge_assignment" %
                                current_round_number)
            assign_judges.add_judges(rounds, judges, panel_points)
        except Exception as e:
            emit_current_exception()
            return render(
                request, 'error.html', {
                    'error_type': "Judge Assignment",
                    'error_name': "",
                    'error_info': str(e)
                })
    return redirect('/pairings/status/')