Esempio n. 1
0
def index():
	page = util.param("page", 1, "int")
	playerId = util.param("playerId", None, "int")
	opponentId = util.param("opponentId", None, "int")
	matchType = util.param("matchType")

	season = util.param("season", None, "int")
	seasons, season, start, end = leaderboardService.seasons(season, session["office"]["id"])

	players = playerService.select(session["office"]["id"])
	matches = matchService.selectCompleteOrReady(session["office"]["id"], playerId, opponentId, matchType, start, end)
	pagedMatches = pagingService.pager(matches, page)
	elo = leaderboardService.elo(session["office"]["id"], start, end)

	return render_template("matches/index.html",
		matches = pagedMatches,
		count = matches.count(),
		paging = pagingService.data(),
		playerId = playerId,
		opponentId = opponentId,
		matchType = matchType,
		matchTypes = matchService.matchTypes,
		players = players,
		elo = elo,
		seasons = seasons,
		season = season
	)
def players_json(id):
	player = playerService.selectById(id)

	season = util.param("season", None, "int")
	startDateTime = util.param("start", None, "int")
	endDateTime = util.param("end", None, "int")

	stats = leaderboardService.playerStats(player, season, startDateTime, endDateTime)
	return Response(json.dumps(stats, default = util.jsonSerial), status = 200, mimetype = "application/json")
def players(id):
	player = playerService.selectById(id)

	season = util.param("season", None, "int")
	startDateTime = util.param("start", None, "int")
	endDateTime = util.param("end", None, "int")

	stats = leaderboardService.playerStats(player, season, startDateTime, endDateTime)
	return render_template("leaderboard/players.html", player = player, stats = stats, matchTypes = leaderboardService.matchTypes, startDateTime = startDateTime, endDateTime = endDateTime)
def index(matchType):
	if matchType not in leaderboardService.matchTypes:
		abort(404)

	season = util.param("season", None, "int")
	startDateTime = util.param("start", None, "int")
	endDateTime = util.param("end", None, "int")

	stats = leaderboardService.matchTypeStats(session["office"]["id"], matchType, season, startDateTime, endDateTime)
	return render_template("leaderboard/index.html", stats = stats, matchTypes = leaderboardService.matchTypes, startDateTime = startDateTime, endDateTime = endDateTime)
def index_json(matchType):
    season = util.param("season", None, "int")
    startDateTime = util.param("start", None, "int")
    endDateTime = util.param("end", None, "int")
    stats = leaderboardService.matchTypeStats(session["office"]["id"],
                                              matchType, season, startDateTime,
                                              endDateTime)
    return Response(json.dumps(stats, default=util.jsonSerial),
                    status=200,
                    mimetype="application/json")
def players_json(id):
    player = playerService.selectById(id)

    season = util.param("season", None, "int")
    startDateTime = util.param("start", None, "int")
    endDateTime = util.param("end", None, "int")

    stats = leaderboardService.playerStats(player, season, startDateTime,
                                           endDateTime)
    return Response(json.dumps(stats, default=util.jsonSerial),
                    status=200,
                    mimetype="application/json")
def players(id):
    player = playerService.selectById(id)

    season = util.param("season", None, "int")
    startDateTime = util.param("start", None, "int")
    endDateTime = util.param("end", None, "int")

    stats = leaderboardService.playerStats(player, season, startDateTime,
                                           endDateTime)
    return render_template("leaderboard/players.html",
                           player=player,
                           stats=stats,
                           matchTypes=leaderboardService.matchTypes,
                           startDateTime=startDateTime,
                           endDateTime=endDateTime)
def logout():
	if current_user.is_authenticated:
		logout_user()
		flash("You've been logged out.", "success")

	next = util.param("next", url_for("mainController.index"))
	return redirect(next)
Esempio n. 9
0
def logout():
    if current_user.is_authenticated:
        logout_user()
        flash("You've been logged out.", "success")

    next = util.param("next", url_for("mainController.index"))
    return redirect(next)
def index(matchType):
    if matchType not in leaderboardService.matchTypes:
        abort(404)

    season = util.param("season", None, "int")
    startDateTime = util.param("start", None, "int")
    endDateTime = util.param("end", None, "int")

    stats = leaderboardService.matchTypeStats(session["office"]["id"],
                                              matchType, season, startDateTime,
                                              endDateTime)
    return render_template("leaderboard/index.html",
                           stats=stats,
                           matchTypes=leaderboardService.matchTypes,
                           startDateTime=startDateTime,
                           endDateTime=endDateTime)
Esempio n. 11
0
def delete(id):
	match = matchService.selectById(id)

	exists(match)

	match, success = matchService.delete(match)

	if success:
		flash("Match has been successfully deleted.", "success")
	else:
		flash("Match could not be deleted .", "warning")

	return redirect(url_for("matchController.index",
		season = util.param("season", None),
		playerId = util.param("playerId", None),
		matchType = util.param("matchType", None)
	))
Esempio n. 12
0
    def test_param(self):
        with self.request:
            test1 = util.param("test1")
            assert test1 == None

            test2 = util.param("test2", "A Value")
            assert test2 == "A Value"

            test3 = util.param("test3", "7")
            assert test3 == "7"
            assert test3 != 7

            test4 = util.param("test4", "9", "int")
            assert test4 == 9
            assert test4 != "9"

            test5 = util.param("test5", "9", "str")
            assert test5 == "9"
            assert test5 != 9
Esempio n. 13
0
	def test_param(self):
		with self.request:
			test1 = util.param("test1")
			assert test1 == None

			test2 = util.param("test2", "A Value")
			assert test2 == "A Value"

			test3 = util.param("test3", "7")
			assert test3 == "7"
			assert test3 != 7

			test4 = util.param("test4", "9", "int")
			assert test4 == 9
			assert test4 != "9"

			test5 = util.param("test5", "9", "str")
			assert test5 == "9"
			assert test5 != 9
def login_form():
	next = util.param("next", "")
	return render_template("authentication/login.html", next = next)
def index_json(matchType):
	season = util.param("season", None, "int")
	startDateTime = util.param("start", None, "int")
	endDateTime = util.param("end", None, "int")
	stats = leaderboardService.matchTypeStats(session["office"]["id"], matchType, season, startDateTime, endDateTime)
	return Response(json.dumps(stats, default = util.jsonSerial), status = 200, mimetype = "application/json")
Esempio n. 16
0
def login_form():
    next = util.param("next", "")
    return render_template("authentication/login.html", next=next)