Example #1
0
def newgame():
    if request.form.get('gname') is None:
        g = gameList()
        g.set('gname', '')
        g.set('gdate', '')
        g.set('team1', '')
        g.set('team2', '')
        g.add()
        allTeams = teamList()
        allTeams.getAll()
        return render_template('game/newgame.html',
                               title='New Game',
                               game=g.data[0],
                               tl=allTeams.data)
    else:
        g = gameList()
        g.set('gname', request.form.get('gname'))
        g.set('gdate', request.form.get('gdate'))
        g.set('team1', request.form.get('team1'))
        g.set('team2', request.form.get('team2'))
        g.add()
        allTeams = teamList()
        allTeams.getAll()
        if g.verifyNew():
            g.insert()
            print(g.data)
            return render_template('game/savedgame.html',
                                   title='Game Saved',
                                   game=g.data[0])
        else:
            return render_template('game/newgame.html',
                                   title='Game Not Saved',
                                   game=g.data[0],
                                   msg=g.errorList,
                                   tl=allTeams.data)
Example #2
0
def newMatchEvent():
    if request.form.get('ename') is None:
        e = matchEventList()
        e.set('ename', '')
        e.set('estat', '')
        e.set('etime', '')
        e.set('pid', '')
        e.set('gid', '')
        e.set('tid', '')
        e.add()

        allPlayers = playerList()
        allPlayers.getByTeam()

        allGames = gameList()
        allGames.getByTeam()

        allTeams = teamList()
        allTeams.getAll()

        return render_template('matchEvent/newMatchEvent.html',
                               title='New matchEvent',
                               matchEvent=e.data[0],
                               pl=allPlayers.data,
                               gl=allGames.data,
                               tl=allTeams.data)
    else:
        e = matchEventList()
        e.set('ename', request.form.get('ename'))
        e.set('estat', request.form.get('estat'))
        e.set('etime', request.form.get('etime'))
        e.set('pid', request.form.get('pid'))  #possible problem with naming
        e.set('gid', request.form.get('gid'))
        e.set('tid', request.form.get('tid'))
        e.add()
        allPlayers = playerList()
        allPlayers.getByTeam()

        allGames = gameList()
        allGames.getByTeam()

        allTeams = teamList()
        allTeams.getAll()
        if e.verifyNew():
            e.insert()
            print(e.data)
            return render_template('matchEvent/savedMatchEvent.html',
                                   title='matchEvent Saved',
                                   matchEvent=e.data[0])
        else:
            return render_template('matchEvent/newMatchEvent.html',
                                   title='matchEvent Not Saved',
                                   matchEvent=e.data[0],
                                   msg=e.errorList,
                                   pl=allPlayers.data,
                                   gl=allGames.data,
                                   tl=allTeams.data)
Example #3
0
def saveMatchEvent():
    e = matchEventList()
    e.set('eid', request.form.get('eid'))
    e.set('ename', request.form.get('ename'))
    e.set('estat', request.form.get('estat'))
    e.set('etime', request.form.get('etime'))
    e.set('pid', request.form.get('pid'))
    e.set('gid', request.form.get('gid'))
    e.set('tid', request.form.get('tid'))
    e.add()
    allPlayers = playerList()
    allPlayers.getByTeam()

    allGames = gameList()
    allGames.getByTeam()

    allTeams = teamList()
    allTeams.getAll()
    if e.verifyChange():
        e.update()
        print(e.data)
        #return ''
        return render_template('matchEvent/savedMatchEvent.html',
                               title='matchEvent Saved',
                               matchEvent=e.data[0])
    else:
        return render_template('matchEvent/matchEvent.html',
                               title='matchEvent Not Saved',
                               matchEvent=e.data[0],
                               msg=e.errorList,
                               pl=allPlayers.data,
                               gl=allGames.data,
                               tl=allTeams.data)
Example #4
0
def matchEvent():
    e = matchEventList()

    allPlayers = playerList()
    allPlayers.getByTeam()

    allGames = gameList()
    allGames.getByTeam()

    allTeams = teamList()
    allTeams.getAll()

    if request.args.get(e.pk) is None:
        return render_template('error.html', msg='No matchEvent id given')

    e.getById(request.args.get(e.pk))
    if len(e.data) <= 0:
        return render_template('error.html', msg='matchEvent not found')

    print(e.data)
    #return ''
    return render_template('matchEvent/matchEvent.html',
                           title='matchEvent',
                           matchEvent=e.data[0],
                           pl=allPlayers.data,
                           gl=allGames.data,
                           tl=allTeams.data)
Example #5
0
def games():
    g = gameList()
    g.getAll()
    g.getByTeam()

    print(g.data)
    #return ''
    return render_template('game/games.html', title='Game List', games=g.data)
Example #6
0
def gameDetails():
    g = gameList()
    gameSummary = gameList()
    gameSummary.getSummary(request.args.get(g.pk))

    if request.args.get(g.pk) is None:
        return render_template('error.html', msg='No game id given')

    g.getById(request.args.get(g.pk))
    if len(g.data) <= 0:
        return render_template('error.html', msg='Game not found')

    print(g.data)
    #print(gameSummary.data)
    return render_template('game/gameDetails.html',
                           title='Game Summmary',
                           games=g.data,
                           gs=gameSummary.data)
Example #7
0
def game():
    g = gameList()
    allTeams = teamList()
    allTeams.getAll()
    if request.args.get(g.pk) is None:
        return render_template('error.html', msg='No game id given')

    g.getById(request.args.get(g.pk))
    if len(g.data) <= 0:
        return render_template('error.html', msg='Game not found')

    print(g.data)
    #return ''
    return render_template('game/game.html',
                           title='Game',
                           game=g.data[0],
                           tl=allTeams.data)
Example #8
0
def savegame():
    g = gameList()
    g.set('gid', request.form.get('gid'))
    g.set('gname', request.form.get('gname'))
    g.set('gdate', request.form.get('gdate'))
    g.set('team1', request.form.get('team1'))
    g.set('team2', request.form.get('team2'))
    g.add()
    allTeams = teamList()
    allTeams.getAll()
    if g.verifyNew():
        g.update()
        print(g.data)
        #return ''
        return render_template('game/savedgame.html',
                               title='Game Saved',
                               game=g.data[0])
    else:
        return render_template('game/game.html',
                               title='Game Not Saved',
                               game=g.data[0],
                               msg=g.errorList,
                               tl=allTeams.data)