Example #1
0
def inject_globals():
	logged_in = False
	if current_user:
		if current_user.is_authenticated:
			logged_in = True

	current_gametype = GameType.selected(None, latest_on_none=True)
	return dict(env=env, logged_in=logged_in, current_gametype=current_gametype,
	            latest_gametype=GameType.latest(), gametypes=GameType.query.all())
Example #2
0
def inject_globals():
    logged_in = False
    if current_user:
        if current_user.is_authenticated:
            logged_in = True

    current_gametype = GameType.selected(None, latest_on_none=True)
    return dict(env=env,
                logged_in=logged_in,
                current_gametype=current_gametype,
                latest_gametype=GameType.latest(),
                gametypes=GameType.query.all())
def create_ai():
    ai = AI(user=current_user,
            name="Unbenannte KI",
            desc="Unbeschriebene KI",
            lang=Lang.query.first(),
            type=GameType.selected())
    db.session.commit()
    return redirect(url_for("authenticated.edit_ai", id=ai.id))
def current_profile():
    user = current_user
    ais = AI.filtered().filter(AI.user == user).all()
    columns = [ais[i:i + 3] for i in range(0, len(ais), 3)]
    return render_template("profile.html",
                           columns=columns,
                           user=user,
                           gametype=GameType.selected())
Example #5
0
def game_list():
    query = Game.query.order_by(Game.id.desc())
    gametype = GameType.selected()
    query = query.filter(Game.type == gametype)

    return render_template("game_list.html",
                           game_list=query.all(),
                           in_progress_games=backend.inprogress_games(),
                           gametype=gametype)
def create_ai():
	gametype = GameType.selected()
	if not gametype:
		abort(400)
	ai = AI(user=current_user, name="Unbenannte KI",
			desc="Unbeschriebene KI", lang=Lang.query.first(),
			type=gametype)
	db.session.commit()
	return redirect(url_for("authenticated.edit_ai", id=ai.id))
def profile_id(id):
    user = User.query.get(id)
    if not user:
        abort(404)
    if not current_user.can_access(user):
        abort(403)

    ais = AI.filtered().filter(AI.user == user).all()
    columns = [ais[i : i + 3] for i in range(0, len(ais), 3)]
    return render_template("profile.html", columns=columns, user=user, gametype=GameType.selected())
Example #8
0
def tournament(id):
	tournament = Tournament.query.get(id)
	if not tournament:
		abort(404)
	has_entered = False
	if current_user and current_user.is_authenticated:
		a = UserTournamentAi.query.filter(UserTournamentAi.user == current_user).filter(UserTournamentAi.type == GameType.selected()).first()
		has_entered = a != None
	return render_template("tournament.html", tournament=tournament, has_entered=has_entered,
	                       ais=UserTournamentAi.query.filter(UserTournamentAi.type_id == tournament.type_id).all(),
	                       gametype=GameType.selected())
def profile_id(id):
    user = User.query.get(id)
    if not user:
        abort(404)
    if not current_user.can_access(user):
        abort(403)

    ais = AI.filtered().filter(AI.user == user).all()
    columns = [ais[i:i + 3] for i in range(0, len(ais), 3)]
    return render_template("profile.html",
                           columns=columns,
                           user=user,
                           gametype=GameType.selected())
Example #10
0
def tournament(id):
    tournament = Tournament.query.get(id)
    if not tournament:
        abort(404)
    has_entered = False
    if current_user and current_user.is_authenticated:
        a = UserTournamentAi.query.filter(
            UserTournamentAi.user == current_user).filter(
                UserTournamentAi.type == GameType.selected()).first()
        has_entered = a != None
    return render_template(
        "tournament.html",
        tournament=tournament,
        has_entered=has_entered,
        ais=UserTournamentAi.query.filter(
            UserTournamentAi.type_id == tournament.type_id).all())
Example #11
0
def game_list():
	query = Game.query.order_by(Game.id.desc())
	gametype = GameType.selected()
	query = query.filter(Game.type == gametype).filter(Game.tournament == None)

	return render_template("game_list.html", game_list=query.all(), in_progress_games=backend.inprogress_games(), gametype=gametype)
Example #12
0
def tutorial():
    return render_template("tutorial.html", gameType=GameType.selected())
Example #13
0
def tutorial():
	return render_template("tutorial.html", gameType=GameType.selected())
Example #14
0
def current_profile():
    user = current_user
    ais = AI.filtered().filter(AI.user == user).all()
    columns = [ais[i : i + 3] for i in range(0, len(ais), 3)]
    return render_template("profile.html", columns=columns, user=user, gametype=GameType.selected())