From daf4ac81175b9a9f636baf18cf8b92a42ff78e16 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 29 Jul 2020 21:35:31 +0200 Subject: [PATCH] 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 --- WebHostLib/static/tracker.css | 4 +++ WebHostLib/static/tracker.js | 1 + WebHostLib/templates/tracker.html | 54 +++++++++++++++---------------- WebHostLib/tracker.py | 5 +-- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/WebHostLib/static/tracker.css b/WebHostLib/static/tracker.css index 293fe7a5..022b493b 100644 --- a/WebHostLib/static/tracker.css +++ b/WebHostLib/static/tracker.css @@ -25,6 +25,10 @@ margin-right: 1rem; } +#multi-stream-link{ + margin-right: 1rem; +} + div.dataTables_wrapper.no-footer .dataTables_scrollBody{ border: none; } diff --git a/WebHostLib/static/tracker.js b/WebHostLib/static/tracker.js index b2cc22e8..50cb518c 100644 --- a/WebHostLib/static/tracker.js +++ b/WebHostLib/static/tracker.js @@ -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); diff --git a/WebHostLib/templates/tracker.html b/WebHostLib/templates/tracker.html index 5519a657..569ad7f5 100644 --- a/WebHostLib/templates/tracker.html +++ b/WebHostLib/templates/tracker.html @@ -10,11 +10,11 @@
- {%- if video -%}Multistream - {%- endif -%} + This tracker will automatically update itself periodically.
{% for team, players in inventory.items() %} @@ -144,34 +144,32 @@
{% endfor %} {% for team, hints in hints.items() %} - {% if hints %} -
- - +
+
+ + + + + + + + + + + + {%- for hint in hints -%} - - - - - - + + + + + + - - - {%- for hint in hints -%} - - - - - - - - - {%- endfor -%} - -
FinderReceiverItemLocationEntranceFound
FinderReceiverItemLocationEntranceFound{{ long_player_names[team, hint.finding_player] }}{{ long_player_names[team, hint.receiving_player] }}{{ hint.item|item_name }}{{ hint.location|location_name }}{% if hint.entrance %}{{ hint.entrance }}{% else %}Vanilla{% endif %}{% if hint.found %}✔{% endif %}
{{ player_names[team, hint.finding_player] }}{{ player_names[team, hint.receiving_player] }}{{ hint.item|item_name }}{{ hint.location|location_name }}{% if hint.entrance %}{{ hint.entrance }}{% else %}Vanilla{% endif %}{% if hint.found %}✔{% endif %}
-
- {% endif %} + {%- endfor -%} + + +
{% endfor %} diff --git a/WebHostLib/tracker.py b/WebHostLib/tracker.py index 00370d2c..2596471a 100644 --- a/WebHostLib/tracker.py +++ b/WebHostLib/tracker.py @@ -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)