Example #1
0
def view_judges(request):
    #Get a list of (id,school_name) tuples
    current_round = TabSettings.objects.get(key="cur_round").value - 1
    checkins = CheckIn.objects.filter(round_number = current_round)
    checked_in_judges = set([c.judge for c in checkins])
    
    def flags(judge):
        result = 0
        if judge in checked_in_judges:
            result |= TabFlags.JUDGE_CHECKED_IN
        else:
            result |= TabFlags.JUDGE_NOT_CHECKED_IN
        if judge.rank < 3.0:
            result |= TabFlags.LOW_RANKED_JUDGE
        if judge.rank >= 3.0 and judge.rank < 5.0:
            result |= TabFlags.MID_RANKED_JUDGE
        if judge.rank >= 5.0:
            result |= TabFlags.HIGH_RANKED_JUDGE
        return result
    
    
    c_judge = [(judge.pk,judge.name, flags(judge), TabFlags.flags_to_symbols(flags(judge)))
               for judge in Judge.objects.order_by("name")]

    all_flags = [[TabFlags.JUDGE_CHECKED_IN, TabFlags.JUDGE_NOT_CHECKED_IN], 
                 [TabFlags.LOW_RANKED_JUDGE, TabFlags.MID_RANKED_JUDGE, TabFlags.HIGH_RANKED_JUDGE]]
    filters, symbol_text = TabFlags.get_filters_and_symbols(all_flags)
    print filters
    return render_to_response('list_data.html', 
                             {'item_type':'judge',
                              'title': "Viewing All Judges",
                              'item_list':c_judge,
                              'filters': filters,
                              'symbol_text': symbol_text}, context_instance=RequestContext(request))
Example #2
0
def view_rooms(request):
    def flags(room):
        result = 0
        if room.rank == 0:
            result |= TabFlags.ROOM_ZERO_RANK
        else:
            result |= TabFlags.ROOM_NON_ZERO_RANK
        return result

    all_flags = [[TabFlags.ROOM_ZERO_RANK, TabFlags.ROOM_NON_ZERO_RANK]]
    all_rooms = [(room.pk, room.name, flags(room), TabFlags.flags_to_symbols(flags(room))) 
                  for room in Room.objects.all().order_by("name")]
    filters, symbol_text = TabFlags.get_filters_and_symbols(all_flags)
    return render(request, 'common/list_data.html', 
                             {'item_type':'room',
                              'title': "Viewing All Rooms",
                              'item_list':all_rooms,
                              'symbol_text':symbol_text,
                              "filters": filters})
Example #3
0
def view_teams(request):
    def flags(t):
        result = 0
        if t.checked_in:
            result |= TabFlags.TEAM_CHECKED_IN
        else:
            result |= TabFlags.TEAM_NOT_CHECKED_IN
        return result

    c_teams = [(t.pk, t.name, flags(t), TabFlags.flags_to_symbols(flags(t)))
               for t in Team.objects.all().order_by("name")]
    all_flags = [[TabFlags.TEAM_CHECKED_IN, TabFlags.TEAM_NOT_CHECKED_IN]]
    filters, symbol_text = TabFlags.get_filters_and_symbols(all_flags)
    return render(request, 'common/list_data.html', 
                             {'item_type':'team',
                              'title': "Viewing All Teams",
                              'item_list': c_teams,
                              'filters': filters,
                              'symbol_text': symbol_text})
Example #4
0
def view_teams(request):
    def flags(team):
        result = 0
        if t.checked_in:
            result |= TabFlags.TEAM_CHECKED_IN
        else:
            result |= TabFlags.TEAM_NOT_CHECKED_IN
        return result

    c_teams = [(t.pk, t.name, flags(t), TabFlags.flags_to_symbols(flags(t)))
               for t in Team.objects.all().order_by("name")]
    all_flags = [[TabFlags.TEAM_CHECKED_IN, TabFlags.TEAM_NOT_CHECKED_IN]]
    filters, symbol_text = TabFlags.get_filters_and_symbols(all_flags)
    return render_to_response('list_data.html', {
        'item_type': 'team',
        'title': "Viewing All Teams",
        'item_list': c_teams,
        'filters': filters,
        'symbol_text': symbol_text
    },
                              context_instance=RequestContext(request))
Example #5
0
def view_rooms(request):
    def flags(room):
        result = 0
        if room.rank == 0:
            result |= TabFlags.ROOM_ZERO_RANK
        else:
            result |= TabFlags.ROOM_NON_ZERO_RANK
        return result

    all_flags = [[TabFlags.ROOM_ZERO_RANK, TabFlags.ROOM_NON_ZERO_RANK]]
    all_rooms = [(room.pk, room.name, flags(room),
                  TabFlags.flags_to_symbols(flags(room)))
                 for room in Room.objects.all()]
    filters, symbol_text = TabFlags.get_filters_and_symbols(all_flags)
    return render(
        request, "common/list_data.html", {
            "item_type": "room",
            "title": "Viewing All Rooms",
            "item_list": all_rooms,
            "symbol_text": symbol_text,
            "filters": filters
        })
Example #6
0
def view_teams(request):
    def flags(team):
        result = 0
        if team.checked_in:
            result |= TabFlags.TEAM_CHECKED_IN
        else:
            result |= TabFlags.TEAM_NOT_CHECKED_IN
        return result

    c_teams = [(team.id, team.display_backend, flags(team),
                TabFlags.flags_to_symbols(flags(team)))
               for team in Team.objects.all()]
    all_flags = [[TabFlags.TEAM_CHECKED_IN, TabFlags.TEAM_NOT_CHECKED_IN]]
    filters, symbol_text = TabFlags.get_filters_and_symbols(all_flags)
    return render(
        request, "common/list_data.html", {
            "item_type": "team",
            "title": "Viewing All Teams",
            "item_list": c_teams,
            "filters": filters,
            "symbol_text": symbol_text
        })
Example #7
0
def view_rooms(request):
    def flags(room):
        result = 0
        if room.rank == 0:
            result |= TabFlags.ROOM_ZERO_RANK
        else:
            result |= TabFlags.ROOM_NON_ZERO_RANK
        return result
    

    all_flags = [[TabFlags.ROOM_ZERO_RANK, TabFlags.ROOM_NON_ZERO_RANK]]
    all_rooms = [(room.pk, room.name, flags(room), TabFlags.flags_to_symbols(flags(room))) 
                  for room in Room.objects.all().order_by("name")]
    filters, symbol_text = TabFlags.get_filters_and_symbols(all_flags)
  
    return render_to_response('list_data.html', 
                             {'item_type':'room',
                              'title': "Viewing All Rooms",
                              'item_list':all_rooms,
                              'symbol_text':symbol_text,
                              "filters": filters},
                              context_instance=RequestContext(request))
Example #8
0
def view_judges(request):
    #Get a list of (id,school_name) tuples
    current_round = TabSettings.objects.get(key="cur_round").value - 1
    checkins = CheckIn.objects.filter(round_number=current_round)
    checkins_next = CheckIn.objects.filter(round_number=(current_round + 1))
    checked_in_judges = set([c.judge for c in checkins])
    checked_in_judges_next = set([c.judge for c in checkins_next])

    def flags(judge):
        result = 0
        if judge in checked_in_judges:
            result |= TabFlags.JUDGE_CHECKED_IN_CUR
        else:
            result |= TabFlags.JUDGE_NOT_CHECKED_IN_CUR
        if judge in checked_in_judges_next:
            result |= TabFlags.JUDGE_CHECKED_IN_NEXT
        else:
            result |= TabFlags.JUDGE_NOT_CHECKED_IN_NEXT

        if judge.rank < 3.0:
            result |= TabFlags.LOW_RANKED_JUDGE
        if judge.rank >= 3.0 and judge.rank < 5.0:
            result |= TabFlags.MID_RANKED_JUDGE
        if judge.rank >= 5.0:
            result |= TabFlags.HIGH_RANKED_JUDGE
        return result

    c_judge = [(judge.pk, judge.name, flags(judge), "(%s)" % judge.ballot_code)
               for judge in Judge.objects.all()]

    all_flags = [[
        TabFlags.JUDGE_CHECKED_IN_CUR, TabFlags.JUDGE_NOT_CHECKED_IN_CUR,
        TabFlags.JUDGE_CHECKED_IN_NEXT, TabFlags.JUDGE_NOT_CHECKED_IN_NEXT
    ],
                 [
                     TabFlags.LOW_RANKED_JUDGE, TabFlags.MID_RANKED_JUDGE,
                     TabFlags.HIGH_RANKED_JUDGE
                 ]]
    filters, _symbol_text = TabFlags.get_filters_and_symbols(all_flags)
    return render(
        request, "common/list_data.html", {
            "item_type": "judge",
            "title": "Viewing All Judges",
            "item_list": c_judge,
            "filters": filters,
        })
Example #9
0
def view_judges(request):
    #Get a list of (id,school_name) tuples
    current_round = TabSettings.objects.get(key="cur_round").value - 1
    checkins = CheckIn.objects.filter(round_number=current_round)
    checkins_next = CheckIn.objects.filter(round_number=(current_round + 1))
    checked_in_judges = set([c.judge for c in checkins])
    checked_in_judges_next = set([c.judge for c in checkins_next])

    def flags(judge):
        result = 0
        if judge in checked_in_judges:
            result |= TabFlags.JUDGE_CHECKED_IN_CUR
        else:
            result |= TabFlags.JUDGE_NOT_CHECKED_IN_CUR
        if judge in checked_in_judges_next:
            result |= TabFlags.JUDGE_CHECKED_IN_NEXT
        else:
            result |= TabFlags.JUDGE_NOT_CHECKED_IN_NEXT

        if judge.rank < 3.0:
            result |= TabFlags.LOW_RANKED_JUDGE
        if judge.rank >= 3.0 and judge.rank < 5.0:
            result |= TabFlags.MID_RANKED_JUDGE
        if judge.rank >= 5.0:
            result |= TabFlags.HIGH_RANKED_JUDGE
        return result

    c_judge = [(judge.pk, judge.name, flags(judge), "(%s)" % judge.ballot_code)
               for judge in Judge.objects.order_by("name")]

    all_flags = [[TabFlags.JUDGE_CHECKED_IN_CUR, TabFlags.JUDGE_NOT_CHECKED_IN_CUR, TabFlags.JUDGE_CHECKED_IN_NEXT, TabFlags.JUDGE_NOT_CHECKED_IN_NEXT],
                 [TabFlags.LOW_RANKED_JUDGE, TabFlags.MID_RANKED_JUDGE, TabFlags.HIGH_RANKED_JUDGE]]
    filters, symbol_text = TabFlags.get_filters_and_symbols(all_flags)
    return render(request, 'common/list_data.html', 
                              {
                                  'item_type':'judge',
                                  'title': "Viewing All Judges",
                                  'item_list':c_judge,
                                  'filters': filters,
                              })