add last activity to tracker
This commit is contained in:
parent
45a24fab27
commit
cbe117a817
|
@ -55,6 +55,7 @@
|
||||||
<th>{{ area }}</th>
|
<th>{{ area }}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<th>Last Activity (UTC)</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -72,6 +73,10 @@
|
||||||
<td style="text-align: center">{{ checks_done }}/{{ checks_total }}</td>
|
<td style="text-align: center">{{ checks_done }}/{{ checks_total }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if activity_timers[(team, player)] %}
|
||||||
|
<td class="table-info">{{ activity_timers[(team, player)].isoformat(sep=" ", timespec='minutes') }}</td>
|
||||||
|
{% else %}
|
||||||
|
<td class="table-warning">No activity</td>{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import collections
|
||||||
|
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from werkzeug.exceptions import abort
|
from werkzeug.exceptions import abort
|
||||||
|
import datetime
|
||||||
|
|
||||||
import Items
|
import Items
|
||||||
from WebHost import app, cache, Room
|
from WebHost import app, cache, Room
|
||||||
|
@ -145,8 +146,6 @@ from MultiServer import get_item_name_from_id
|
||||||
@app.route('/tracker/<int:room>')
|
@app.route('/tracker/<int:room>')
|
||||||
@cache.memoize(timeout=60) # update every minute
|
@cache.memoize(timeout=60) # update every minute
|
||||||
def get_tracker(room: int):
|
def get_tracker(room: int):
|
||||||
# This more WIP than the rest
|
|
||||||
|
|
||||||
room = Room.get(id=room)
|
room = Room.get(id=room)
|
||||||
if not room:
|
if not room:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
@ -171,6 +170,10 @@ def get_tracker(room: int):
|
||||||
if game_state:
|
if game_state:
|
||||||
inventory[team][player][106] = 1 # Triforce
|
inventory[team][player][106] = 1 # Triforce
|
||||||
|
|
||||||
|
activity_timers = {}
|
||||||
|
for (team, player), timestamp in room.multisave.get("client_activity_timers", []):
|
||||||
|
activity_timers[team, player] = datetime.datetime.utcfromtimestamp(timestamp)
|
||||||
|
|
||||||
player_names = {}
|
player_names = {}
|
||||||
for team, names in enumerate(multidata['names']):
|
for team, names in enumerate(multidata['names']):
|
||||||
for player, name in enumerate(names, 1):
|
for player, name in enumerate(names, 1):
|
||||||
|
@ -180,6 +183,6 @@ def get_tracker(room: int):
|
||||||
lookup_id_to_name=Items.lookup_id_to_name, player_names=player_names,
|
lookup_id_to_name=Items.lookup_id_to_name, player_names=player_names,
|
||||||
tracking_names=tracking_names, tracking_ids=tracking_ids, room=room, icons=icons,
|
tracking_names=tracking_names, tracking_ids=tracking_ids, room=room, icons=icons,
|
||||||
multi_items=multi_items, checks_done=checks_done, ordered_areas=ordered_areas,
|
multi_items=multi_items, checks_done=checks_done, ordered_areas=ordered_areas,
|
||||||
checks_in_area=checks_in_area)
|
checks_in_area=checks_in_area, activity_timers=activity_timers)
|
||||||
else:
|
else:
|
||||||
return "Tracker disabled for this room."
|
return "Tracker disabled for this room."
|
||||||
|
|
Loading…
Reference in New Issue