Example #1
0
def account(request):
    """View the account/team details page."""
    context = {
        'members_left': settings.MAX_TEAM_SIZE - request.user.competitor.team.size(),
        'windows': queries.all_windows().reverse(),
    }
    return render(request, 'ctflex/misc/account.html', context)
Example #2
0
def account(request):
    """View the account/team details page."""
    context = {
        'members_left': settings.MAX_TEAM_SIZE - request.user.competitor.team.size(),
        'windows': queries.all_windows().reverse(),
    }
    return render(request, 'ctflex/misc/account.html', context)
Example #3
0
def team_public_detail(request, *, team_id):
    """View the given team's data."""

    try:
        other_team = models.Team.objects.get(id=team_id)
    except models.Team.DoesNotExist:
        raise Http404()

    context = {
        'windows': queries.all_windows().reverse(),
        'other_team': other_team,
        'total_score': queries.score(team=other_team, window=None)
    }
    return render(request, 'ctflex/misc/team.html', context)
Example #4
0
def team_public_detail(request, *, team_id):
    """View the given team's data."""

    try:
        other_team = models.Team.objects.get(id=team_id)
    except models.Team.DoesNotExist:
        raise Http404()

    context = {
        'windows': queries.all_windows().reverse(),
        'other_team': other_team,
        'total_score': queries.score(team=other_team, window=None),
        'score_normalization': settings.SCORE_NORMALIZATION,
    }
    return render(request, 'ctflex/misc/team.html', context)
Example #5
0
def windowed_context(window):
    """Return context needed for CTFlex templates using the window dropdown"""
    return {
        'window': window,
        'windows': queries.all_windows(),
    }
Example #6
0
def index(request):
    return render(request, 'ctflex/misc/index.html', {
        'windows': queries.all_windows(),
    })
Example #7
0
def windowed_context(window):
    """Return context needed for CTFlex templates using the window dropdown"""
    return {
        'window': window,
        'windows': queries.all_windows(),
    }
Example #8
0
def index(request):
    return render(request, 'ctflex/misc/index.html', {
        'windows': queries.all_windows(),
    })
Example #9
0
        try:
            solves = (queries._solves_in_timer(team=competitor.team, window=window)
                      .filter(competitor=competitor))
        except AttributeError:
            return 0
        return solves.aggregate(score=Sum('problem__points'))['score'] or 0 if solves else 0


    for competitor in team.competitor_set.all():
        competitor_data = {}

        overall_score = queries._normalize(team=competitor, score_function=score_function,
                                           windows_with_points=windows_with_points)
        competitor_data[None] = overall_score

        for window in queries.all_windows():
            score = score_function(team=competitor, window=window)
            competitor_data[window] = score

        team_data[competitor] = competitor_data

    data[(team_overall_score, team)] = team_data

items = sorted(data.items(), key=lambda item: item[0][0], reverse=True)

file.write('\n')
file.write("Date: {}\n".format(datetime.datetime.now()))
file.write("Note: Overall score is not merely the sum of individual rounds’ scores.\n")
file.write("Note: Only solves submitted during a timer are counted.\n")
file.write('\n')
Example #10
0
def refresh_boards():
    for window in chain(queries.all_windows(), [None]):
        queries._board_uncached(window)