golf/views/view_tournament.py
def updateScores(request):
    """
    Score the tournament
    Save the data
    Return the rankings grosses and nets and colors per cell
    """
    tournamentId = request.POST['tournamentId']
    tournamentName = request.POST['tournamentName']
    tournamentRound = json.loads(request.POST['tournamentRound'])
    scorecard = json.loads(request.POST['scorecard'])
    players = json.loads(request.POST['players'])
    viewTab = request.POST['viewTab']

    s = Scorecard()
    if (scorecard['scorer'] != ''):
        try:
            scorer = Player.objects.get(club_member_number=scorecard['scorerId'])
            s.scorer = scorer
        except Player.DoesNotExist:
            s.external_scorer = scorecard['scorer']
    if (scorecard['attest'] != ''):
        try:
            attest = Player.objects.get(club_member_number=scorecard['attestId'])
            s.attest = attest
        except Player.DoesNotExist:
            s.external_attest = scorecard['attest']
    if (scorecard['startTime'] != ''):
        s.start_time = scorecard['startTime']
    if (scorecard['finishTime'] != ''):
        s.finish_time = scorecard['finishTime']
    s.save()

    for player in players:
        player['scorecardId'] = s.id

    formatPlugin = FormatPlugin.objects.get(id=tournamentRound['formatId'])
    classModule = importlib.import_module('golf.formatplugins.'+formatPlugin.class_module)
    classAccess = getattr(classModule, formatPlugin.class_name)
    classInst = classAccess(tournamentId, tournamentRound['id'])
    classInst.updateScores(players)
    
    roundStatus = getTournamentRoundStatus(tournamentRound['id'], viewTab)
    return JsonResponse(roundStatus)

    Score the tournament
    Save the data
    Return the rankings grosses and nets and colors per cell
    
Score the tournament
Save the data
Return the rankings grosses and nets and colors per cell
Score the tournament Save the data Return the rankings grosses and nets and colors per cell
def updateScores(request):
    tournamentId = request.POST['tournamentId']
    tournamentName = request.POST['tournamentName']
    tournamentRound = json.loads(request.POST['tournamentRound'])
    scorecard = json.loads(request.POST['scorecard'])
    players = json.loads(request.POST['players'])
    viewTab = request.POST['viewTab']
    s = Scorecard()
    if (scorecard['scorer'] != ''):
        try:
            scorer = Player.objects.get(club_member_number=scorecard['scorerId'])
            s.scorer = scorer
        except Player.DoesNotExist:
            s.external_scorer = scorecard['scorer']
    if (scorecard['attest'] != ''):
        try:
            attest = Player.objects.get(club_member_number=scorecard['attestId'])
            s.attest = attest
        except Player.DoesNotExist:
            s.external_attest = scorecard['attest']
    if (scorecard['startTime'] != ''):
        s.start_time = scorecard['startTime']
    if (scorecard['finishTime'] != ''):
        s.finish_time = scorecard['finishTime']
    s.save()
    for player in players:
        player['scorecardId'] = s.id
    formatPlugin = FormatPlugin.objects.get(id=tournamentRound['formatId'])
    classModule = importlib.import_module('golf.formatplugins.'+formatPlugin.class_module)
    classAccess = getattr(classModule, formatPlugin.class_name)
    classInst = classAccess(tournamentId, tournamentRound['id'])
    classInst.updateScores(players)
    roundStatus = getTournamentRoundStatus(tournamentRound['id'], viewTab)
    return JsonResponse(roundStatus)
def updateScores ( request ) : tournamentId = request . POST [ 'tournamentId' ] tournamentName = request . POST [ 'tournamentName' ] tournamentRound = json . loads ( request . POST [ 'tournamentRound' ] ) scorecard = json . loads ( request . POST [ 'scorecard' ] ) players = json . loads ( request . POST [ 'players' ] ) viewTab = request . POST [ 'viewTab' ] s = Scorecard ( ) if ( scorecard [ 'scorer' ] != '' ) : try : scorer = Player . objects . get ( club_member_number = scorecard [ 'scorerId' ] ) s . scorer = scorer except Player . DoesNotExist : s . external_scorer = scorecard [ 'scorer' ] if ( scorecard [ 'attest' ] != '' ) : try : attest = Player . objects . get ( club_member_number = scorecard [ 'attestId' ] ) s . attest = attest except Player . DoesNotExist : s . external_attest = scorecard [ 'attest' ] if ( scorecard [ 'startTime' ] != '' ) : s . start_time = scorecard [ 'startTime' ] if ( scorecard [ 'finishTime' ] != '' ) : s . finish_time = scorecard [ 'finishTime' ] s . save ( ) for player in players : player [ 'scorecardId' ] = s . id formatPlugin = FormatPlugin . objects . get ( id = tournamentRound [ 'formatId' ] ) classModule = importlib . import_module ( 'golf.formatplugins.' + formatPlugin . class_module ) classAccess = getattr ( classModule , formatPlugin . class_name ) classInst = classAccess ( tournamentId , tournamentRound [ 'id' ] ) classInst . updateScores ( players ) roundStatus = getTournamentRoundStatus ( tournamentRound [ 'id' ] , viewTab ) return JsonResponse ( roundStatus )
Score the tournament
Save the data
Return the rankings grosses and nets and colors per cell
Score the tournament Save the data Return the rankings grosses and nets and colors per cell
"""
    Score the tournament
    Save the data
    Return the rankings grosses and nets and colors per cell
    """
request