コード例 #1
0
ファイル: server.py プロジェクト: sezenm/itucsdb1517
def statistic_edit_page(key=None):
    store = statistic_operations()
    storeSeason = season_operations()
    storePlayer = player_operations()
    statistic = store.get_statistic(key) if key is not None else None
    seasons = storeSeason.get_seasons()
    players = storePlayer.get_players()
    now = datetime.datetime.now()
    return render_template('statistic_edit.html', statistic=statistic, seasons=seasons,players=players, current_time=now.ctime())
コード例 #2
0
ファイル: server.py プロジェクト: sezenm/itucsdb1517
def statistic_page(key=None,operation=None, error=None):
    if request.method == 'GET':
        if request.args.get('operation') == 'delete':
            store = statistic_operations()
            result=store.delete_statistic(request.args.get('key'))
            return redirect(url_for('admin.statistic_page', error=result))
        else:
            store = statistic_operations()
            statistics=store.get_statistics()
            now = datetime.datetime.now()
            error = request.args.get('error')
            return render_template('admin_statistics.html', statistics=statistics, error=error, current_time=now.ctime())
    else:
        if request.form['submit']=='cancel':
            return redirect(url_for('admin.statistic_page'))

        else:
            if request.form['key_value']=='':
                assistnumber = request.form['assistnumber']
                blocknumber = request.form['blocknumber']
                score = request.form['score']
                cardnumber = request.form['cardnumber']
                seasonid = request.form['seasonid']
                playerid = request.form['playerid']
                statistic = Statistic(None, assistnumber, blocknumber, score, cardnumber, seasonid, None, playerid, None, 0)
                store = statistic_operations()
                result=store.add_statistic(statistic)
                return redirect(url_for('admin.statistic_page', error=result))
            else:
                key = request.form['key_value']
                assistnumber = request.form['assistnumber']
                blocknumber = request.form['blocknumber']
                score = request.form['score']
                cardnumber = request.form['cardnumber']
                seasonid = request.form['seasonid']
                playerid = request.form['playerid']
                store = statistic_operations()
                result=store.update_statistic(key,assistnumber,blocknumber,score,cardnumber,seasonid,playerid)
                return redirect(url_for('admin.statistic_page', error=result))
コード例 #3
0
def statistics_page():
    if request.method == 'GET':
        store = statistic_operations()
        statistics=store.get_statistics()
        now = datetime.datetime.now()
        return render_template('statistics.html', statistics=statistics, current_time=now.ctime())