mirror of
https://github.com/FAUSheppy/open-web-leaderboard.git
synced 2025-12-05 22:51:36 +01:00
visual improvements, migrate main view to dataTable
This commit is contained in:
@@ -39,10 +39,24 @@ class MapSummary:
|
|||||||
self.averageTime = datetime.timedelta(seconds=int(averageSeconds))
|
self.averageTime = datetime.timedelta(seconds=int(averageSeconds))
|
||||||
|
|
||||||
mapper = [ 1 if x == 0 else -1 for x in self.predictions ]
|
mapper = [ 1 if x == 0 else -1 for x in self.predictions ]
|
||||||
|
reverseMapper = [ 1 if x == 0 else 0 for x in self.predictions ]
|
||||||
self.ratingSystemDeviation = 0
|
self.ratingSystemDeviation = 0
|
||||||
for i in range(0, len(self.confidence)):
|
|
||||||
self.ratingSystemDeviation += mapper[i] * self.confidence[i]
|
confidenceCutoff = 60
|
||||||
self.ratingSystemDeviation /= self.totalGames
|
confidenceTupels = list(filter(lambda x: x[1] > confidenceCutoff,
|
||||||
|
zip(reverseMapper, self.confidence)))
|
||||||
|
|
||||||
|
mapperTupels = list(filter(lambda x: x[1] > confidenceCutoff,
|
||||||
|
zip(mapper, self.confidence)))
|
||||||
|
|
||||||
|
for i in range(0, len(mapperTupels)):
|
||||||
|
self.ratingSystemDeviation += mapperTupels[i][0] * max(100, 50+mapperTupels[i][1])
|
||||||
|
|
||||||
|
self.ratingSystemDeviation /= len(mapperTupels)
|
||||||
|
self.predictionCorrectPercentage = sum([x[0] for x in confidenceTupels])
|
||||||
|
self.predictionCorrectPercentage /= len(confidenceTupels)
|
||||||
|
self.predictionCorrectPercentage *= 100
|
||||||
|
self.predictionCorrectPercentage = round(self.predictionCorrectPercentage)
|
||||||
|
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class PlayerInLeaderboard:
|
|||||||
self.mu = mu
|
self.mu = mu
|
||||||
self.sigma = sigma
|
self.sigma = sigma
|
||||||
self.rating = int(self.mu) - 2*int(self.sigma)
|
self.rating = int(self.mu) - 2*int(self.sigma)
|
||||||
|
self.ratingStr = str(self.rating)
|
||||||
self.games = int(games)
|
self.games = int(games)
|
||||||
self.wins = int(wins)
|
self.wins = int(wins)
|
||||||
self.loses = self.games - self.wins
|
self.loses = self.games - self.wins
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ def maps():
|
|||||||
roundsWithMap = list(filter(lambda r: r.mapName == mapName , rounds))
|
roundsWithMap = list(filter(lambda r: r.mapName == mapName , rounds))
|
||||||
maps += [MapSummary.MapSummary(roundsWithMap)]
|
maps += [MapSummary.MapSummary(roundsWithMap)]
|
||||||
|
|
||||||
|
allMaps = MapSummary.MapSummary(rounds)
|
||||||
|
allMaps.mapName = "All Maps*"
|
||||||
|
maps += [allMaps]
|
||||||
|
|
||||||
|
|
||||||
mapsFiltered = filter(lambda x: x.mapName, maps)
|
mapsFiltered = filter(lambda x: x.mapName, maps)
|
||||||
return flask.render_template("maps.html", maps=mapsFiltered)
|
return flask.render_template("maps.html", maps=mapsFiltered)
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,13 @@ if(isLastPage){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if request was a playersearch, move to player */
|
/* if request was a playersearch, move to player */
|
||||||
targetPlayerElements = document.getElementsByClassName("targetPlayer")
|
targetPlayer = document.getElementById("targetPlayer")
|
||||||
if(targetPlayerElements.length == 1){
|
if(targetPlayer){
|
||||||
/* scrollIntoView broken on android?? wtf */
|
/* scrollIntoView broken on android?? wtf */
|
||||||
scrollOptions = {beahviour: "smooth", block:"center"}
|
scrollOptions = {beahviour: "smooth", block:"center"}
|
||||||
targetPlayerElements[0].scrollIntoView(scrollOptions);
|
targetPlayer.scrollIntoView(scrollOptions);
|
||||||
|
targetPlayer.style.background = "green";
|
||||||
|
targetPlayer.children.forEach(c => c.style.borderColor="green")
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alert on mobile devices if player was not found */
|
/* alert on mobile devices if player was not found */
|
||||||
|
|||||||
@@ -250,3 +250,11 @@ body{
|
|||||||
.hover-to-75:hover{
|
.hover-to-75:hover{
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
.patreon{
|
||||||
|
background: #d71d1d;
|
||||||
|
padding-left: 0.5vw;
|
||||||
|
padding-right: 0.5vw;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,27 +6,35 @@
|
|||||||
<script src="static/buttons.js" defer></script>
|
<script src="static/buttons.js" defer></script>
|
||||||
{% include "default_head_content.html" %}
|
{% include "default_head_content.html" %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="bg-special">
|
||||||
{% include 'navbar_leaderboard.html' %}
|
{% include 'navbar_leaderboard.html' %}
|
||||||
<div class="container mt-3 mb-3" role="main">
|
|
||||||
<div class=colum-names>{{ columNames }}</div>
|
<div class="container mt-3 mb-3" role="main">
|
||||||
{% for player in playerList %}
|
<table id="tableMain" class="table table-striped table-bordered table-sm"
|
||||||
{% set count = loop.index + start %}
|
cellspacing="0" width="100%">
|
||||||
{% if count % 2 == 0 %}
|
<thead>
|
||||||
<div class="line-even {% if searchName == player.name %}targetPlayer{% endif %}">
|
<tr>
|
||||||
<a href="/player?id={{ player.playerId }}">
|
<th class="th-sm font-weight-bold">Rank</th>
|
||||||
{{ player.getLineHTML(count) }}
|
<th class="th-sm font-weight-bold">Player</th>
|
||||||
</a>
|
<th class="th-sm font-weight-bold">Games</th>
|
||||||
</div>
|
<th class="th-sm font-weight-bold">Rating</th>
|
||||||
{% else %}
|
<th class="th-sm font-weight-bold">Winratio %</th>
|
||||||
<div class="line-odd {% if searchName == player.name %}targetPlayer{% endif %}">
|
</tr>
|
||||||
<a href="/player?id={{ player.playerId }}">
|
</thead>
|
||||||
{{ player.getLineHTML(count) }}
|
<tbody>
|
||||||
</a>
|
{% for p in playerList %}
|
||||||
</div>
|
{% set count = loop.index + start %}
|
||||||
{% endif %}
|
<tr {% if searchName and searchName == p.name %} id="targetPlayer" {% endif %}>
|
||||||
{% endfor %}
|
<td>{{ count }}</td>
|
||||||
{{ endOfBoardIndicator }}
|
<td><a href="/player?id={{ p.playerId }}">{{ p.name }}</a></td>
|
||||||
|
<td>{{ p.games }}</td>
|
||||||
|
<td>{{ p.rating }}</td>
|
||||||
|
<td>{{ p.winratio }}%</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{ endOfBoardIndicator }}
|
||||||
</div>
|
</div>
|
||||||
{% include 'footer.html' %}
|
{% include 'footer.html' %}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<a style="color: rgba(255,255,255,.5);"
|
<a style="color: rgba(255,255,255,.5);"
|
||||||
class="footerLink" href="https://blog.atlantishq.de/about">Impressum/Legal</a>
|
class="footerLink" href="https://blog.atlantishq.de/about">Impressum/Legal</a>
|
||||||
<a style="color: rgba(255,255,255,.5);"
|
<a style="color: rgba(255,255,255,.5);"
|
||||||
class="footerLink mid" href="https://blog.atlantishq.de/post/insurgency-rating-1/">
|
class="footerLink mid" href="steam://connect/athq.de/:27026">
|
||||||
How does it work?</a>
|
Join the Server!</a>
|
||||||
<a style="color: rgba(255,255,255,.5);"
|
<a style="color: rgba(255,255,255,.5);"
|
||||||
class="footerLink" href="https://github.com/FAUSheppy/skillbird">Star on GitHub</a>
|
class="footerLink" href="https://github.com/FAUSheppy/skillbird">Star on GitHub</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,24 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Maps</title>
|
<title>Maps</title>
|
||||||
<meta name="Description" content="Insurgency Map Overview">
|
<meta name="Description" content="Insurgency Map Overview">
|
||||||
<link rel="stylesheet" type="text/css" href="/static/site.css">
|
{% include "default_head_content.html" %}
|
||||||
<link rel="shortcut icon" href="/static/defaultFavicon.ico">
|
|
||||||
|
|
||||||
<!-- needed for @media-css mofiers -->
|
|
||||||
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
|
||||||
|
|
||||||
<!-- Font Awesome -->
|
|
||||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
|
|
||||||
<!-- Bootstrap core CSS -->
|
|
||||||
<link href="static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<!-- Material Design Bootstrap -->
|
|
||||||
<link href="static/bootstrap/css/mdb.min.css" rel="stylesheet">
|
|
||||||
|
|
||||||
<script src="static/bootstrap/js/jquery.js"></script>
|
|
||||||
<script src="static/bootstrap/js/popper.js"></script>
|
|
||||||
<script src="static/bootstrap/js/bootstrap.js"></script>
|
|
||||||
<script src="static/bootstrap/js/mdb.min.js"></script>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-special">
|
<body class="bg-special">
|
||||||
{% include 'navbar.html' %}
|
{% include 'navbar.html' %}
|
||||||
@@ -34,34 +17,50 @@
|
|||||||
<th class="th-sm font-weight-bold">Insurgent Win</th>
|
<th class="th-sm font-weight-bold">Insurgent Win</th>
|
||||||
<th class="th-sm font-weight-bold">Security Win</th>
|
<th class="th-sm font-weight-bold">Security Win</th>
|
||||||
<th class="th-sm font-weight-bold">Average Time</th>
|
<th class="th-sm font-weight-bold">Average Time</th>
|
||||||
<th class="th-sm font-weight-bold">Rating System Deviation*</th>
|
<th class="th-sm font-weight-bold">Rating System Performance</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for m in maps %}
|
{% for m in maps %}
|
||||||
<tr {% if m.totalGames < 20 %} style="opacity: 0.4;" {% endif %}>
|
<tr>
|
||||||
<td>{{ m.mapName }}</td>
|
<td>{{ m.mapName }}</td>
|
||||||
<td>{{ m.totalGames }}</td>
|
<td>{{ m.totalGames }}</td>
|
||||||
<td>{{ '%0.2f' | format(m.insurgentWinPercent) }}%</td>
|
<td>{{ '%0.2f' | format(m.insurgentWinPercent) }}%</td>
|
||||||
<td>{{ '%0.2f' | format(m.securityWinPercent) }}%</td>
|
<td>{{ '%0.2f' | format(m.securityWinPercent) }}%</td>
|
||||||
<td>{{ m.averageTime }}</td>
|
<td>{{ m.averageTime }}</td>
|
||||||
{% if m.ratingSystemDeviation >= 0 %}
|
{% if m.ratingSystemDeviation == 0 or m.predictionCorrectPercentage == 0%}
|
||||||
<td style="color: green;">+{{ '%0.2f' | format(m.ratingSystemDeviation) }}%
|
<td style="color: grey;">N/A</td>
|
||||||
|
{% elif m.ratingSystemDeviation >= 0 %}
|
||||||
|
<td style="color: green;">
|
||||||
|
+{{ '%0.2f' | format(m.ratingSystemDeviation) }}%
|
||||||
|
({{ m.predictionCorrectPercentage }}% Correct)
|
||||||
</td>
|
</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td style="color: red;">{{ '%0.2f' | format(m.ratingSystemDeviation) }}%
|
<td style="color: red;">
|
||||||
|
{{ '%0.2f' | format(m.ratingSystemDeviation) }}%
|
||||||
|
({{ m.predictionCorrectPercentage }}% Correct)
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
{# <!--
|
||||||
|
{{ m.confidence }}
|
||||||
|
{{ m.predictions }}
|
||||||
|
--> #}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="mt-2 mb-2">
|
<div class="mt-2 pt-3 mb-2">
|
||||||
<p>
|
<small>
|
||||||
<i>*Rating System Deviation:</i> Percentage difference between the ratio of correctly predicted games by the rating system, to the average confidence of those predictions. For example: 10 games played, 6 games correctly predicted based on ratings with an average confidence of 50% is +20% deviation.
|
*Map Tracking was only implemented recently, that is why there are many rounds without a recorded mapname.
|
||||||
</p>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% include 'footer.html' %}
|
{% include 'footer.html' %}
|
||||||
|
<script defer>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#tableMain').DataTable();
|
||||||
|
$('.dataTables_length').addClass('bs-select');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
<a class="nav-link" href="steam://connect/athq.de/:27015">Server 2</a>
|
<a class="nav-link" href="steam://connect/athq.de/:27015">Server 2</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="navbar-brand hover-to-75" style="position: unset !important;" href="https://www.buymeacoffee.com/sheppy">
|
<a class="navbar-brand hover-to-75 patreon" style="position: unset !important;" href="https://www.patreon.com/erlangen_sheppy">Support me
|
||||||
<img style="max-height: 1.5rem;" src='/static/buymeacoffee.png'></img>
|
<!--<img style="max-height: 1.5rem;" src='/static/patreon.jpg'></img>-->
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="navbar-brand hover-to-75" style="position: unset !important;" href="https://www.buymeacoffee.com/sheppy">
|
<a class="navbar-brand hover-to-75 patreon" style="position: unset !important;" href="https://www.patreon.com/erlangen_sheppy">Support me
|
||||||
<img style="max-height: 2rem;" src='/static/buymeacoffee.png'></img>
|
<!--<img style="max-height: 2rem;" src='/static/patreon.png'></img>-->
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item right mr-2">
|
<li class="nav-item right mr-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user