Front end should be solid even when bcak end is giving bad data. Fixed issue where breakdowns were not disappearing when they are the current scene.

This commit is contained in:
Ada Werefox 2024-03-13 14:33:01 -05:00
parent 6f573685e5
commit 8c300cc72a
2 changed files with 26 additions and 3 deletions

View File

@ -29,7 +29,22 @@ function show_breakdown(scene) {
Array.from(document.getElementById("breakdown-list").children).forEach(
(breakdown) => {
if (breakdown.id == `${scene}-breakdown`) {
breakdown.classList.remove("hidden");
console.log(
`${
document
.getElementById("breakdown-current")
.querySelector(".breakdown-block-title").textContent
}, ${scene}`
);
if (
!(
document
.getElementById("breakdown-current")
.querySelector(".breakdown-block-title").textContent == scene
)
) {
breakdown.classList.remove("hidden");
}
} else {
breakdown.classList.add("hidden");
}

View File

@ -15,7 +15,6 @@ defaults = {
'backend_filepath': '',
'backend_filepath_updated': False,
}
# default_address = 'http://localhost:8000/'
# logging.basicConfig(encoding='utf-8', level=logging.DEBUG)
@ -40,7 +39,14 @@ def index(request):
try:
request_data = requests.get(
f'{listen_address}spoiler', timeout=5, verify=True).text
logger.info(f'{request_data}')
if (loads(request_data)['Scenes'] == None):
with open('empty_spoiler.json', 'r') as t:
try:
request_data = t.read()
is_hidden = False
except:
return
except:
with open('empty_spoiler.json', 'r') as t:
try:
@ -65,6 +71,7 @@ def index(request):
'R', '➡️').strip() for k, l in temp_codes[x].items()} for x in temp_codes.keys()}
except:
return
tracker_debug = tracker_output['Debug']
tracker_totals = tracker_output['Totals']
tracker_current_scene = tracker_output['Current']['Scene']
@ -85,6 +92,7 @@ def index(request):
server_address_form.fields['server_address_form'].initial = listen_address
backend_filepath_form = BackendFilepathForm()
backend_filepath_form.fields['backend_filepath_form'].initial = backend_filepath
logging.info(tracker_scenes)
context = {
'backend_filepath': backend_filepath,
'server_address': listen_address,