Ejemplo n.º 1
0
def create(tournament, match, **params):
    """Create a new attachment for the specific match."""
    return api.fetch_and_parse(
        "POST",
        "tournaments/%s/matches/%s/attachments" % (tournament, match),
        "match_attachment",
        **params)
Ejemplo n.º 2
0
def create(tournament, name, **params):
    """Add a participant to a tournament."""
    params.update({"name": name})

    return api.fetch_and_parse("POST",
                               "tournaments/%s/participants" % tournament,
                               "participant", **params)
Ejemplo n.º 3
0
def finalize(tournament, **params):
    """Finalize a tournament that has had all match scores submitted,
    rendering its results permanent.

    """
    return api.fetch_and_parse("POST", "tournaments/%s/finalize" % tournament,
                               **params)
Ejemplo n.º 4
0
def start(tournament, **params):
    """Start a tournament, opening up matches for score reporting.

    The tournament must have at least 2 participants.

    """
    return api.fetch_and_parse("POST", "tournaments/%s/start" % tournament,
                               **params)
Ejemplo n.º 5
0
def create(tournament, name, **params):
    """Add a participant to a tournament."""
    params.update({"name": name})

    return api.fetch_and_parse(
        "POST",
        "tournaments/%s/participants" % tournament,
        "participant",
        **params)
Ejemplo n.º 6
0
def open_for_predictions(tournament, **params):
    """Open predictions for a tournament

    Sets the state of the tournament to start accepting predictions.
    'prediction_method' must be set to 1 (exponential scoring) or 2 (linear scoring) to use this option.

    """
    return api.fetch_and_parse(
        "POST", "tournaments/%s/open_for_predictions" % tournament, **params)
Ejemplo n.º 7
0
def create(name, url, tournament_type="single elimination", **params):
    """Create a new tournament."""
    params.update({
        "name": name,
        "url": url,
        "tournament_type": tournament_type,
    })

    return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
Ejemplo n.º 8
0
def reset(tournament, **params):
    """Reset a tournament, clearing all of its scores and attachments.

    You can then add/remove/edit participants before starting the
    tournament again.

    """
    return api.fetch_and_parse("POST", "tournaments/%s/reset" % tournament,
                               **params)
Ejemplo n.º 9
0
def create(name, url, tournament_type="single elimination", **params):
    """Create a new tournament."""
    params.update({
        "name": name,
        "url": url,
        "tournament_type": tournament_type,
    })

    return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
Ejemplo n.º 10
0
def create(name, url, tournament_type="single elimination", **params):
    """Create a new tournament."""
    params.update({
        "name": name,
        "url": url,
        "tournament_type": tournament_type,
	"sequential_pairings": "true",
	"show_rounds": "true",
    })

    return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
Ejemplo n.º 11
0
def process_check_ins(tournament, **params):
    """This should be invoked after a tournament's
    check-in window closes before the tournament is started.

    1) Marks participants who have not checked in as inactive.
    2) Moves inactive participants to bottom seeds (ordered by original seed).
    3) Transitions the tournament state from 'checking_in' to 'checked_in'

    """
    return api.fetch_and_parse("POST",
                               "tournaments/%s/process_check_ins" % tournament,
                               **params)
Ejemplo n.º 12
0
def abort_check_in(tournament, **params):
    """When your tournament is in a 'checking_in' or 'checked_in' state,
    there's no way to edit the tournament's start time (start_at)
    or check-in duration (check_in_duration).
    You must first abort check-in, then you may edit those attributes.

    1) Makes all participants active and clears their checked_in_at times.
    2) Transitions the tournament state from 'checking_in' or 'checked_in' to 'pending'

    """
    return api.fetch_and_parse("POST",
                               "tournaments/%s/abort_check_in" % tournament,
                               **params)
Ejemplo n.º 13
0
def bulk_add(tournament, names, **params):
    """Bulk add participants to a tournament (up until it is started).

    :param tournament: the tournament's name or id
    :param names: the names of the participants
    :type tournament: int or string
    :type names: list or tuple
    :return: each participants info
    :rtype: a list of dictionaries

    """
    params.update({"name": names})

    return api.fetch_and_parse(
        "POST",
        "tournaments/%s/participants/bulk_add" % tournament,
        "participants[]",
        **params)
Ejemplo n.º 14
0
def bulk_add(tournament, names, **params):
    """Bulk add participants to a tournament (up until it is started).

    :param tournament: the tournament's name or id
    :param names: the names of the participants
    :type tournament: int or string
    :type names: list or tuple
    :return: each participants info
    :rtype: a list of dictionaries

    """
    params.update({"name": names})

    return api.fetch_and_parse(
        "POST",
        "tournaments/%s/participants/bulk_add" % tournament,
        "participants[]",
        **params)
Ejemplo n.º 15
0
def show(tournament, match_id, **params):
    """Retrieve a single match record for a tournament."""
    return api.fetch_and_parse(
        "GET", "tournaments/%s/matches/%s" % (tournament, match_id), **params)
Ejemplo n.º 16
0
def index(tournament, **params):
    """Retrieve a tournament's match list."""
    return api.fetch_and_parse("GET", "tournaments/%s/matches" % tournament,
                               **params)
Ejemplo n.º 17
0
def show(tournament, participant_id):
    """Retrieve a single participant record for a tournament."""
    return api.fetch_and_parse(
        "GET", "tournaments/%s/participants/%s" % (tournament, participant_id))
Ejemplo n.º 18
0
def index(tournament):
    """Retrieve a tournament's participant list."""
    return api.fetch_and_parse("GET",
                               "tournaments/%s/participants" % tournament)
Ejemplo n.º 19
0
def show(tournament, match, attachment):
    """Retrieve a single match attachment record."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches/%s/attachments/%s" % (tournament, match, attachment))
Ejemplo n.º 20
0
def index(tournament, match):
    """Retrieve a set of attachments created for a specific match."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches/%s/attachments" % (tournament, match))
Ejemplo n.º 21
0
def show(tournament, match_id, **params):
    """Retrieve a single match record for a tournament."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches/%s" % (tournament, match_id),
        **params)
Ejemplo n.º 22
0
def index(tournament, **params):
    """Retrieve a tournament's match list."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches" % tournament,
        **params)
Ejemplo n.º 23
0
def show(tournament):
    """Retrieve a single tournament record created with your account."""
    return api.fetch_and_parse("GET", "tournaments/%s" % tournament)
Ejemplo n.º 24
0
def index(**params):
    """Retrieve a set of tournaments created with your account."""
    return api.fetch_and_parse("GET", "tournaments", **params)
Ejemplo n.º 25
0
def show(tournament, **params):
    """Retrieve a single tournament record created with your account."""
    return api.fetch_and_parse("GET", "tournaments/%s" % tournament, **params)
Ejemplo n.º 26
0
def show(tournament, participant_id):
    """Retrieve a single participant record for a tournament."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/participants/%s" % (tournament, participant_id))
Ejemplo n.º 27
0
def index(tournament):
    """Retrieve a tournament's participant list."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/participants" % tournament)
Ejemplo n.º 28
0
def index(**params):
    """Retrieve a set of tournaments created with your account."""
    return api.fetch_and_parse("GET", "tournaments", **params)