WebHost: Tracker updates

- use long player names for hint table
- allow multistream link to be updated without page refresh
- add a notice that the tracker is self updating
This commit is contained in:
Fabian Dill 2020-07-29 21:35:31 +02:00
parent 89e1c05ef3
commit daf4ac8117
4 changed files with 34 additions and 30 deletions

View File

@ -25,6 +25,10 @@
margin-right: 1rem;
}
#multi-stream-link{
margin-right: 1rem;
}
div.dataTables_wrapper.no-footer .dataTables_scrollBody{
border: none;
}

View File

@ -43,6 +43,7 @@ window.addEventListener('load', () => {
$(old_table.settings()[0].nScrollBody).scrollTop(topscroll);
$(old_table.settings()[0].nScrollBody).scrollLeft(leftscroll);
});
$("#multi-stream-link").replaceWith(target.find("#multi-stream-link"));
} else {
console.log("Failed to connect to Server, in order to update Table Data.");
console.log(response);

View File

@ -10,11 +10,11 @@
<div id="tracker-wrapper" data-tracker="{{ room.tracker|suuid }}">
<div id="tracker-header-bar">
<input placeholder="Search" id="search"/>
{%- if video -%}<span><a target="_blank" href="https://multistream.me/
<span{% if not video %} hidden{% endif %} id="multi-stream-link"><a target="_blank" href="https://multistream.me/
{%- for platform, link in video.values()|unique(False, 1)-%}
{%- if platform == "Twitch" -%}t{%- else -%}yt{%- endif -%}:{{- link -}}/
{%- endfor -%}">Multistream</a></span>
{%- endif -%}
<span>This tracker will automatically update itself periodically.</span>
</div>
<div id="tables-container">
{% for team, players in inventory.items() %}
@ -144,34 +144,32 @@
</div>
{% endfor %}
{% for team, hints in hints.items() %}
{% if hints %}
<div class="table-wrapper">
<table class="table non-unique-item-table">
<thead>
<div class="table-wrapper">
<table class="table non-unique-item-table">
<thead>
<tr>
<th>Finder</th>
<th>Receiver</th>
<th>Item</th>
<th>Location</th>
<th>Entrance</th>
<th>Found</th>
</tr>
</thead>
<tbody>
{%- for hint in hints -%}
<tr>
<th>Finder</th>
<th>Receiver</th>
<th>Item</th>
<th>Location</th>
<th>Entrance</th>
<th>Found</th>
<td>{{ long_player_names[team, hint.finding_player] }}</td>
<td>{{ long_player_names[team, hint.receiving_player] }}</td>
<td>{{ hint.item|item_name }}</td>
<td>{{ hint.location|location_name }}</td>
<td>{% if hint.entrance %}{{ hint.entrance }}{% else %}Vanilla{% endif %}</td>
<td>{% if hint.found %}✔{% endif %}</td>
</tr>
</thead>
<tbody>
{%- for hint in hints -%}
<tr>
<td>{{ player_names[team, hint.finding_player] }}</td>
<td>{{ player_names[team, hint.receiving_player] }}</td>
<td>{{ hint.item|item_name }}</td>
<td>{{ hint.location|location_name }}</td>
<td>{% if hint.entrance %}{{ hint.entrance }}{% else %}Vanilla{% endif %}</td>
<td>{% if hint.found %}✔{% endif %}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{% endif %}
{%- endfor -%}
</tbody>
</table>
</div>
{% endfor %}
</div>
</div>

View File

@ -297,9 +297,10 @@ def get_tracker(tracker: UUID):
for team, names in enumerate(names):
for player, name in enumerate(names, 1):
player_names[(team, player)] = name
long_player_names = player_names.copy()
for (team, player), alias in room.multisave.get("name_aliases", []):
player_names[(team, player)] = alias
long_player_names[(team, player)] = f"{alias} ({long_player_names[(team, player)]})"
video = {}
for (team, player), data in room.multisave.get("video", []):
@ -312,4 +313,4 @@ def get_tracker(tracker: UUID):
checks_in_area=checks_in_area, activity_timers=activity_timers,
key_locations=key_locations, small_key_ids=small_key_ids, big_key_ids=big_key_ids,
video=video, big_key_locations=key_locations if use_door_tracker else big_key_locations,
hints=hints)
hints=hints, long_player_names = long_player_names)