Updated the tracker to not crash if the back end isn't running or can't be found.
This commit is contained in:
parent
50f5660740
commit
dc4bcb19fa
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,7 +1,7 @@
|
||||
**/.venv/**
|
||||
**/__pycache__/**
|
||||
*.pyc
|
||||
TunicTransitionTracker
|
||||
TunicTransitionTracker*
|
||||
settings.json
|
||||
**/db.sqlite3
|
||||
**/node_modules/**
|
||||
|
Binary file not shown.
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -7,12 +5,11 @@
|
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta charset="UTF-8" />
|
||||
{% comment %} <meta http-equiv="refresh" content="3"> {% endcomment %}
|
||||
{% comment %} <meta http-equiv="refresh" content="3" /> {% endcomment %}
|
||||
{% load static tailwind_tags %}
|
||||
{% tailwind_css %}
|
||||
{% load static %}
|
||||
<script src="{% static 'tracker/assets/test.js' %}"></script>
|
||||
|
||||
<script src="{% static 'tracker/assets/test.js' %}"></script>
|
||||
</head>
|
||||
<body class="bg-[#242424]">
|
||||
{% block content %}
|
||||
|
@ -4,106 +4,116 @@
|
||||
{% block content %}
|
||||
<div class="container monospace">
|
||||
<div class="m-4 ring-4 rounded-md text-[#eee] bg-bluelight-translucent-dark ring-bluelight-dark">
|
||||
<div class="p-4 flex flex-col space-y-4">
|
||||
<div class="flex pt-4 text-2xl mx-2">
|
||||
<span class="relative inline-block align-middle h-8 w-8"><img src="{% static 'tracker/images/neofox_flag_trans_256.png' %}" alt="A trans pride fox emoji." /></span>
|
||||
Tunic Transition Tracker
|
||||
</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-md" />
|
||||
<div class="p-4 flex flex-col max-w-full space-y-2 md:space-y-4 text-md rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
|
||||
<div class="text-lg">Overview</div>
|
||||
<div class="flex flex-col md:flex-row md:space-x-4 space-y-2 md:space-y-0">
|
||||
<div class="flex basis-1/2" id="overview_checks">Checks: {{ totals.Checks.Undiscovered }}/{{ totals.Checks.Total }}</div>
|
||||
<div class="flex basis-1/2" id="overview_entrances">Entrances: {{ totals.Entrances.Undiscovered }}/{{ totals.Entrances.Total }}</div>
|
||||
{% if debug != '' %}
|
||||
<div class="p-4 flex flex-col space-y-4">
|
||||
<div class="flex pt-4 text-2xl mx-2">
|
||||
<span class="relative inline-block align-middle h-8 w-8"><img src="{% static 'tracker/images/neofox_flag_trans_256.png' %}" alt="A trans pride fox emoji." /></span>
|
||||
Tunic Transition Tracker
|
||||
</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-md" />
|
||||
<details class="group p-2 flex flex-col space-y-4 rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
|
||||
<summary class="text-lg">Breakdown</summary>
|
||||
<div class="grid gap-4 md:grid-cols-3 grid-flow-row">
|
||||
{% for scene, scene_totals in totals.items %}
|
||||
{% if scene != 'Entrances' and scene != 'Checks' %}
|
||||
<div class="p-2 flex flex-col rounded-md ring-4 ring-bluelight-dark bg-opacity-50 {% if scene_totals.Checks.Undiscovered > 0 and scene_totals.Entrances.Undiscovered > 0 %}
|
||||
|
||||
<div class="p-4 flex flex-col max-w-full space-y-2 md:space-y-4 text-md rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
|
||||
<div class="text-lg">Overview</div>
|
||||
<div class="flex flex-col md:flex-row md:space-x-4 space-y-2 md:space-y-0">
|
||||
<div class="flex basis-1/2" id="overview_checks">Checks: {{ totals.Checks.Undiscovered }}/{{ totals.Checks.Total }}</div>
|
||||
<div class="flex basis-1/2" id="overview_entrances">Entrances: {{ totals.Entrances.Undiscovered }}/{{ totals.Entrances.Total }}</div>
|
||||
</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-md" />
|
||||
<details class="group p-2 flex flex-col space-y-4 rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
|
||||
<summary class="text-lg">Breakdown</summary>
|
||||
<div class="grid gap-4 md:grid-cols-3 grid-flow-row">
|
||||
{% for scene, scene_totals in totals.items %}
|
||||
{% if scene != 'Entrances' and scene != 'Checks' %}
|
||||
{% if scene_totals.Checks.Undiscovered > 0 and scene_totals.Entrances.Undiscovered > 0 %}
|
||||
<div class="p-2 flex flex-col rounded-md ring-4 ring-bluelight-dark bg-opacity-50 bg-green-900">
|
||||
<div>{{ scene }}:</div>
|
||||
<div>Checks: {{ scene_totals.Checks.Undiscovered }}/{{ scene_totals.Checks.Total }}</div>
|
||||
<div>Entrances: {{ scene_totals.Entrances.Undiscovered }}/{{ scene_totals.Entrances.Total }}</div>
|
||||
</div>
|
||||
{% elif scene_totals.Checks.Undiscovered > 0 %}
|
||||
|
||||
<div class="p-2 flex flex-col rounded-md ring-4 ring-bluelight-dark bg-opacity-50 bg-yellow-900">
|
||||
<div>{{ scene }}:</div>
|
||||
<div>Checks: {{ scene_totals.Checks.Undiscovered }}/{{ scene_totals.Checks.Total }}</div>
|
||||
<div>Entrances: {{ scene_totals.Entrances.Undiscovered }}/{{ scene_totals.Entrances.Total }}</div>
|
||||
</div>
|
||||
{% elif scene_totals.Entrances.Undiscovered > 0 %}
|
||||
|
||||
{% endif %}">
|
||||
<div>{{ scene }}:</div>
|
||||
<div>Checks: {{ scene_totals.Checks.Undiscovered }}/{{ scene_totals.Checks.Total }}</div>
|
||||
<div>Entrances: {{ scene_totals.Entrances.Undiscovered }}/{{ scene_totals.Entrances.Total }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="p-2 flex flex-col rounded-md ring-4 ring-bluelight-dark bg-opacity-50 bg-blue-900">
|
||||
<div>{{ scene }}:</div>
|
||||
<div>Checks: {{ scene_totals.Checks.Undiscovered }}/{{ scene_totals.Checks.Total }}</div>
|
||||
<div>Entrances: {{ scene_totals.Entrances.Undiscovered }}/{{ scene_totals.Entrances.Total }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<div class="p-4 flex flex-col max-w-full rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
|
||||
<div class="flex text-lg" id="current_scene_text">{{ scene }}</div>
|
||||
<div class="flex flex-col md:flex-row justify-center md:space-x-4">
|
||||
<div class="flex flex-col basis-1/2 overflow-hidden">
|
||||
<div class="my-2 flex flex-col space-y-2">
|
||||
<div class="text-md" id="current_scene_checks_title">Checks: {{ scene_data.Totals.Checks.Undiscovered }}/{{ scene_data.Totals.Checks.Total }}</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-md" />
|
||||
</div>
|
||||
<div class="pb-4 flex flex-col space-y-2 overflow-x-scroll" id="current_scene_checks_list">
|
||||
{% if scene_data.Totals.Checks.Total > 0 %}
|
||||
{% for check_name, check in scene_data.Checks.items %}
|
||||
{% if not check.Check %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1">❌ {{ check_name }}</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1" hidden></ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col basis-1/2 overflow-hidden">
|
||||
<div class="my-2 flex flex-col space-y-2">
|
||||
<div class="text-md" id="current_scene_entrances_title">Entrances: {{ scene_data.Totals.Entrances.Undiscovered }}/{{ scene_data.Totals.Entrances.Total }}</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-md" />
|
||||
</div>
|
||||
<div class="pb-4 flex flex-col space-y-2 overflow-x-scroll" id="current_scene_entrances_list">
|
||||
{% if scene_data.Totals.Entrances.Total > 0 %}
|
||||
{% for entrance_origin, entrance_destination in scene_data.Entrances.items %}
|
||||
{% if not entrance_destination.Entrance != '' %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1">❌ {{ entrance_origin }}</ul>
|
||||
{% else %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1" hidden>❌ {{ entrance_origin }}</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1" hidden></ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-x-scroll">
|
||||
<div class="flex flex-col space-y-2 mx-auto min-w-max" id="current_scene_entrances_mapped">
|
||||
{% for entrance_origin, entrance_destination in scene_data.Entrances.items %}
|
||||
{% if entrance_destination.Entrance %}
|
||||
<ul class="bg-bluelight rounded-md px-1">✔️ {{ entrance_origin }} -> {{ entrance_destination.Entrance }}</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<details class="group flex max-w-full rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
|
||||
<summary class="justify-start p-2">Tracker Debug</summary>
|
||||
<div class="p-2 pl-4 pr-4 flex flex-col space-y-2">
|
||||
<div>
|
||||
<ul>Name: {{ debug.Name }}</ul>
|
||||
<ul>Seed: {{ debug.Seed }}</ul>
|
||||
<ul>Spoiler Seed: {{ debug.SpoilerSeed }}</ul>
|
||||
<ul>Archipelago: {{ debug.Archipelago }}</ul>
|
||||
<ul>Randomized: {{ debug.Randomized }}</ul>
|
||||
<ul>Hex Quest: {{ debug.HexQuest }}</ul>
|
||||
<ul>Entrance Randomizer: {{ debug.EntranceRando }}</ul>
|
||||
<ul>Fixed Shops: {{ debug.FixedShops }}</ul>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<div class="p-4 flex flex-col max-w-full rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
|
||||
<div class="flex text-lg" id="current_scene_text">{{ scene }}</div>
|
||||
<div class="flex flex-col md:flex-row justify-center md:space-x-4">
|
||||
<div class="flex flex-col basis-1/2 overflow-hidden">
|
||||
<div class="my-2 flex flex-col space-y-2">
|
||||
<div class="text-md" id="current_scene_checks_title">Checks: {{ scene_data.Totals.Checks.Undiscovered }}/{{ scene_data.Totals.Checks.Total }}</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-md" />
|
||||
</div>
|
||||
<div class="pb-4 flex flex-col space-y-2 overflow-x-scroll" id="current_scene_checks_list">
|
||||
{% if scene_data.Totals.Checks.Total > 0 %}
|
||||
{% for check_name, check in scene_data.Checks.items %}
|
||||
{% if not check.Check %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1">❌ {{ check_name }}</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1" hidden></ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col basis-1/2 overflow-hidden">
|
||||
<div class="my-2 flex flex-col space-y-2">
|
||||
<div class="text-md" id="current_scene_entrances_title">Entrances: {{ scene_data.Totals.Entrances.Undiscovered }}/{{ scene_data.Totals.Entrances.Total }}</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-md" />
|
||||
</div>
|
||||
<div class="pb-4 flex flex-col space-y-2 overflow-x-scroll" id="current_scene_entrances_list">
|
||||
{% if scene_data.Totals.Entrances.Total > 0 %}
|
||||
{% for entrance_origin, entrance_destination in scene_data.Entrances.items %}
|
||||
{% if not entrance_destination.Entrance != '' %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1">❌ {{ entrance_origin }}</ul>
|
||||
{% else %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1" hidden>❌ {{ entrance_origin }}</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<ul class="min-w-max bg-bluelight-translucent rounded-md px-1" hidden></ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-x-scroll">
|
||||
<div class="flex flex-col space-y-2 mx-auto min-w-max" id="current_scene_entrances_mapped">
|
||||
{% for entrance_origin, entrance_destination in scene_data.Entrances.items %}
|
||||
{% if entrance_destination.Entrance %}
|
||||
<ul class="bg-bluelight rounded-md px-1">✔️ {{ entrance_origin }} -> {{ entrance_destination.Entrance }}</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<details class="group flex max-w-full rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
|
||||
<summary class="justify-start p-2">Tracker Debug</summary>
|
||||
<div class="p-2 pl-4 pr-4 flex flex-col space-y-2">
|
||||
<div>
|
||||
<ul>Name: {{ debug.Name }}</ul>
|
||||
<ul>Seed: {{ debug.Seed }}</ul>
|
||||
<ul>Spoiler Seed: {{ debug.SpoilerSeed }}</ul>
|
||||
<ul>Archipelago: {{ debug.Archipelago }}</ul>
|
||||
<ul>Randomized: {{ debug.Randomized }}</ul>
|
||||
<ul>Hex Quest: {{ debug.HexQuest }}</ul>
|
||||
<ul>Entrance Randomizer: {{ debug.EntranceRando }}</ul>
|
||||
<ul>Fixed Shops: {{ debug.FixedShops }}</ul>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -9,7 +9,19 @@ import requests
|
||||
|
||||
|
||||
def index(request):
|
||||
tracker_output = loads(requests.get('http://localhost:8000/spoiler').text)
|
||||
request_data = None
|
||||
try:
|
||||
request_data = requests.get('http://localhost:8000/spoiler').text
|
||||
except:
|
||||
context = {
|
||||
"debug": "",
|
||||
"totals": "",
|
||||
"scene": "",
|
||||
"scene_data": ""
|
||||
}
|
||||
template = loader.get_template("tracker/index.html")
|
||||
return HttpResponse(template.render(context, request))
|
||||
tracker_output = loads()
|
||||
# with open('spoiler.json', 'r') as t:
|
||||
# tracker_output = loads(t.read())
|
||||
tracker_debug = tracker_output["Debug"]
|
||||
@ -38,7 +50,7 @@ def index(request):
|
||||
for i, check in enumerate(temp_tracker_checks.keys()):
|
||||
temp_data = {
|
||||
"Check": temp_tracker_checks[check],
|
||||
"CheckNum": floor(int(i)%3)
|
||||
"CheckNum": floor(int(i) % 3)
|
||||
}
|
||||
temp_tracker_checks[check] = temp_data
|
||||
tracker_current_scene_data["Checks"] = temp_tracker_checks
|
||||
@ -46,7 +58,7 @@ def index(request):
|
||||
for i, entrance in enumerate(temp_tracker_entrances.keys()):
|
||||
temp_data = {
|
||||
"Entrance": temp_tracker_entrances[entrance],
|
||||
"EntranceNum": floor(int(i)%3)
|
||||
"EntranceNum": floor(int(i) % 3)
|
||||
}
|
||||
temp_tracker_entrances[entrance] = temp_data
|
||||
tracker_current_scene_data["Entrances"] = temp_tracker_entrances
|
||||
|
Loading…
Reference in New Issue
Block a user