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>
|
||||
|
||||
</head>
|
||||
<body class="bg-[#242424]">
|
||||
{% block content %}
|
||||
|
@ -4,6 +4,7 @@
|
||||
{% block content %}
|
||||
<div class="container monospace">
|
||||
<div class="m-4 ring-4 rounded-md text-[#eee] bg-bluelight-translucent-dark ring-bluelight-dark">
|
||||
{% 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>
|
||||
@ -22,17 +23,25 @@
|
||||
<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 %}
|
||||
|
||||
{% elif scene_totals.Checks.Undiscovered > 0 %}
|
||||
|
||||
{% elif scene_totals.Entrances.Undiscovered > 0 %}
|
||||
|
||||
{% endif %}">
|
||||
{% 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 %}
|
||||
<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>
|
||||
@ -104,6 +113,7 @@
|
||||
</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