def _process_auction(args): """ This function processes the auction notification message from the Jack server. It alerts the participants to a new auction in the schedule. """ draft_id = args['draft'] order = int(args['order']) name = args['player'] position = args['position'] # Validated on save value = int(args['value']) draft = Draft.objects.get(id=draft_id) player = Player(draft=draft, order=order, name=name, position=position, value=value) player.save()
def _test_add_players(draft_id, num_players): """ This function add the specified number of players to the draft. Only for testing purposes. """ draft = Draft.objects.get(id=draft_id) for i in range(num_players): try: player = Player(draft=draft, order=i+1, name=' '.join(('Player', str(i + 1))), position=choice(POSITIONS), value=randint(1,50)) player.save() except IntegrityError as e: print 'Skipping duplicate entry' pass