Beispiel #1
0
def coach_compare(request, coach, coach2):
    coach = get_object_or_404(Coach, slug=coach)
    coach2 = get_object_or_404(Coach, slug=coach2)
    game_list = Game.objects.select_related().filter(coach1=coach, coach2=coach2).order_by('-date')
    totals = game_list.filter(date__lte=datetime.date.today()).values("t1_result").annotate(count=Count("id")).order_by('t1_result')
    wins, losses, ties = calculate_record(totals)
    last_home_loss, last_road_win = last_home_loss_road_win(game_list)
    return render_to_response('coaches/coach_compare.html', {'coach': coach, 'coach2': coach2, 'game_list': game_list, 'wins': wins, 'losses':losses, 'ties':ties, 'last_home_loss':last_home_loss, 'last_road_win':last_road_win })
Beispiel #2
0
def team_vs(request, team1, team2, outcome=None):
    team_1 = get_object_or_404(College, slug=team1)
    try:
        team_2 = College.objects.get(slug=team2)
        if team_1 == team_2:
            team_2 = College.objects.none()
    except:
        team_2 = College.objects.none()
    if outcome:
        games = Game.objects.select_related().filter(team1__in=team_1.collegeyear_set.all(), team2__in=team_2.collegeyear_set.all(), t1_result=outcome[0].upper()).order_by('-date')
    else:
        games = Game.objects.select_related().filter(team1__in=team_1.collegeyear_set.all(), team2__in=team_2.collegeyear_set.all()).order_by('-date')
    totals = Game.objects.filter(team1__in=team_1.collegeyear_set.all(), team2__in=team_2.collegeyear_set.all(), date__lte=datetime.date.today()).values("t1_result").annotate(count=Count("id")).order_by('t1_result')
    wins, losses, ties = calculate_record(totals)
    last_home_loss, last_road_win = last_home_loss_road_win(games)
    return render_to_response('college/team_vs.html', {'team_1': team_1, 'team_2': team_2, 'games': games, 'last_home_loss': last_home_loss, 'last_road_win': last_road_win, 'wins': wins, 'losses': losses, 'ties': ties, 'outcome': outcome })
Beispiel #3
0
def coach_compare(request, coach, coach2):
    coach = get_object_or_404(Coach, slug=coach)
    coach2 = get_object_or_404(Coach, slug=coach2)
    game_list = Game.objects.select_related().filter(
        coach1=coach, coach2=coach2).order_by('-date')
    totals = game_list.filter(
        date__lte=datetime.date.today()).values("t1_result").annotate(
            count=Count("id")).order_by('t1_result')
    wins, losses, ties = calculate_record(totals)
    last_home_loss, last_road_win = last_home_loss_road_win(game_list)
    return render_to_response(
        'coaches/coach_compare.html', {
            'coach': coach,
            'coach2': coach2,
            'game_list': game_list,
            'wins': wins,
            'losses': losses,
            'ties': ties,
            'last_home_loss': last_home_loss,
            'last_road_win': last_road_win
        })
Beispiel #4
0
def team_vs(request, team1, team2, outcome=None):
    team_1 = get_object_or_404(College, slug=team1)
    try:
        team_2 = College.objects.get(slug=team2)
        if team_1 == team_2:
            team_2 = College.objects.none()
    except:
        team_2 = College.objects.none()
    if outcome:
        games = Game.objects.select_related().filter(
            team1__in=team_1.collegeyear_set.all(),
            team2__in=team_2.collegeyear_set.all(),
            t1_result=outcome[0].upper()).order_by('-date')
    else:
        games = Game.objects.select_related().filter(
            team1__in=team_1.collegeyear_set.all(),
            team2__in=team_2.collegeyear_set.all()).order_by('-date')
    totals = Game.objects.filter(
        team1__in=team_1.collegeyear_set.all(),
        team2__in=team_2.collegeyear_set.all(),
        date__lte=datetime.date.today()).values("t1_result").annotate(
            count=Count("id")).order_by('t1_result')
    wins, losses, ties = calculate_record(totals)
    last_home_loss, last_road_win = last_home_loss_road_win(games)
    return render_to_response(
        'college/team_vs.html', {
            'team_1': team_1,
            'team_2': team_2,
            'games': games,
            'last_home_loss': last_home_loss,
            'last_road_win': last_road_win,
            'wins': wins,
            'losses': losses,
            'ties': ties,
            'outcome': outcome
        })