Beispiel #1
0
def register(request, game_id, photo_file):
    """ register a player for a game, validate the cell out of the photo and pass back number of registered game players or err msg 
        if there is an error
    """
    try:
        game = Game.objects.get(pk=game_id)
    except Game.DoesNotExist:
        return HttpResponse("Game can't be found")

    if not game.is_closed:
        try:
            cell, photo_url = validate_registration(photo_file)
            p = Player.objects.get(game=game, cell=cell)
        except Player.DoesNotExist:
            p = Player(game=game, photo_url=photo_url, cell=cell)
            p.save()
            p.initialize()
        except MSException, e:
            logger.info("Didn't validate something!", exc_info=True)
            return HttpResponse("Upload failed. Check phone # and try again.")
        return HttpResponse(game.active_count())
Beispiel #2
0
def register(request, game_id, photo_file):
    """ register a player for a game, validate the cell out of the photo and pass back number of registered game players or err msg 
        if there is an error
    """
    try:
        game = Game.objects.get(pk=game_id)
    except Game.DoesNotExist:
        return HttpResponse("Game can't be found")

    if not game.is_closed:
        try:
            cell, photo_url = validate_registration(photo_file)
            p = Player.objects.get(game=game, cell=cell)
        except Player.DoesNotExist:
            p = Player(game=game, photo_url=photo_url, cell=cell)
            p.save()
            p.initialize()
        except MSException, e:
            logger.info("Didn't validate something!", exc_info=True)
            return HttpResponse("Upload failed. Check phone # and try again.")
        return HttpResponse(game.active_count())
Beispiel #3
0
def generate_players(game_id, num=25):
    for i in range(num):
        cell = "%010d" % i
        p = Player(game_id=game_id, photo_url="http://ms.matrix.vc/cell-of-the-admin.jpg", cell=cell)
        p.save()
        p.initialize()
Beispiel #4
0
#!/usr/bin/python

from matrix.ms.models import Game, Player

g = Game.objects.get(pk=1)
for i in range(200):
    p = Player(game=g,
               cell='6175759474',
               photo_url='http://ms.matrix.vc/6175759474.jpg')
    p.save()
    p.initialize()
#!/usr/bin/python


from matrix.ms.models import Game, Player

g = Game.objects.get(pk=1)
for i in range(200):
    p = Player(game=g, cell='6175759474', photo_url='http://ms.matrix.vc/6175759474.jpg')
    p.save()
    p.initialize()
    
Beispiel #6
0
def generate_players(game_id, num=25):
    for i in range(num):
        cell = '%010d' % i
        p = Player(game_id=game_id, photo_url='http://ms.matrix.vc/cell-of-the-admin.jpg', cell=cell)
        p.save()
        p.initialize()