示例#1
0
def _process_bidder(args):
    """ This function processes the bidder notification message from the Jack
    server. It signals the participation of a new biider/manager in the
    specified draft. To do this we simply add a new manager row to the database.
    """

    draft_id = args['draft']
    name = args['name']
    budget = int(args['budget'])

    draft = Draft.objects.get(id=draft_id)
    manager = Manager(draft=draft, name=name, budget=budget)
    manager.save()
示例#2
0
def _test_add_managers(draft_id, num_managers):
    """ This function adds the specifed number of managers to the draft. Only
    for testing purposes.
    """

    draft = Draft.objects.get(id=draft_id)
    for i in range(num_managers):
        try:
            manager = Manager(draft=draft, name=" ".join(("Manager", str(i + 1))), budget=200)
            manager.save()
        except IntegrityError as e:
            print "Skipping duplicate entry"
            pass