Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #16
0
def index(tournament, **params):
    """Retrieve a tournament's match list."""
    return api.fetch_and_parse("GET", "tournaments/%s/matches" % tournament,
                               **params)
Example #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))
Example #18
0
def index(tournament):
    """Retrieve a tournament's participant list."""
    return api.fetch_and_parse("GET",
                               "tournaments/%s/participants" % tournament)
Example #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))
Example #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))
Example #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)
Example #22
0
def index(tournament, **params):
    """Retrieve a tournament's match list."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches" % tournament,
        **params)
Example #23
0
def show(tournament):
    """Retrieve a single tournament record created with your account."""
    return api.fetch_and_parse("GET", "tournaments/%s" % tournament)
Example #24
0
def index(**params):
    """Retrieve a set of tournaments created with your account."""
    return api.fetch_and_parse("GET", "tournaments", **params)
Example #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)
Example #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))
Example #27
0
def index(tournament):
    """Retrieve a tournament's participant list."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/participants" % tournament)
Example #28
0
def index(**params):
    """Retrieve a set of tournaments created with your account."""
    return api.fetch_and_parse("GET", "tournaments", **params)