fix some problems with livegames

This commit is contained in:
2020-12-22 16:37:44 +01:00
parent e9920ac0e9
commit e8276b8438
2 changed files with 32 additions and 26 deletions

View File

@@ -134,8 +134,8 @@ class DatabaseConnection:
'''Get current live games'''
cursor = self.connPlayers.cursor()
cursor.execute('''SELECT * FROM live WHERE time > ? LIMIT 2''',
(datetime.datetime.now().timestamp(),))
cursor.execute('''SELECT * FROM live WHERE time > ? ORDER BY time DESC LIMIT 2''', (
(datetime.datetime.now() - datetime.timedelta(minutes=100)).timestamp(),))
liveRounds = []
for row in cursor:
@@ -150,8 +150,10 @@ class DatabaseConnection:
security += [p]
p.update({"active_time":-1})
dbRow = [time, json.dumps(insurgent), json.loads(security), "N/A", 0, 0 ,0]
r = Round.Round(row)
dbRow = [time, json.dumps(insurgent), json.dumps(security), -1, "N/A", duration, 0 ,0]
r = Round.Round(dbRow)
r.winners = [ self.getPlayerById(p.playerId) for p in r.winners]
r.losers = [ self.getPlayerById(p.playerId) for p in r.losers]
r.id = trackingID
liveRounds += [r]

View File

@@ -19,16 +19,10 @@
<div class="row">
<div class="col-sm">
<h1>Tracking ID {{ r.id }}</h1>
<h4>{{ r.startTime }}</h4>
<h4>Tracking ID {{ r.id }}</h1>
<h2>{{ r.startTime }}</h4>
<h4>Map: {{ r.mapName }}</h4>
<h4>Duration: {{ r.duration }}</h4>
{% if r.invalid %}
<div>
<h5 style="color: red;">{{ r.invalid | safe }}</h5>
</div>
{% endif %}
</div>
</div>
@@ -41,7 +35,28 @@
<h5>Security</h5>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="row">
<div class="col-sm">
<h6>Name</h6>
</div>
<div class="col-sm">
<h6>Rating</h6>
</div>
</div>
</div>
<div class="col-sm">
<div class="row">
<div class="col-sm">
<h6>Name</h6>
</div>
<div class="col-sm">
<h6>Rating</h6>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
{# WINNERS == INSURGENT for livegames #}
@@ -51,11 +66,7 @@
<a href="/player?id={{ p.playerId }}">{{ p.name }}</a>
</div>
<div class="col-sm">
{% if not r.invalid %}
<small style="color: green;">
{{ p.ratingChangeString | safe }}
</small>
{% endif %}
{{ p.rating }}
</div>
</div>
{% endfor %}
@@ -68,14 +79,7 @@
<a href="/player?id={{ p.playerId }}">{{ p.name }}</a>
</div>
<div class="col-sm">
{{ p.participation }}%
</div>
<div class="col-sm">
{% if not r.invalid %}
<small style="color: red;">
{{ p.ratingChangeString | safe }}
</small>
{% endif %}
{{ p.rating }}
</div>
</div>
{% endfor %}