Added a few more parseInt cases where I am fairly certain they would have been needed, fixed an issue where dummy data objects were not being given a "found" attribute, which would sometimes cause the resulting output to be "undefined" in the summary block.

This commit is contained in:
Ada Werefox 2024-04-26 00:06:05 -05:00
parent 76ead448a6
commit fe983f30e6
1 changed files with 17 additions and 10 deletions

View File

@ -728,12 +728,14 @@ async function initialize_summary(summary_element, scene, checks, entrances) {
summary_element.querySelector(".summary-title").textContent = scene;
const summary_checks = summary_element.querySelector(".summary-checks");
summary_checks.dataset.checksCollected = parseInt(checks.collected + checks.found);
summary_checks.dataset.checksCollected = parseInt(
checks.collected + checks.found
);
summary_checks.dataset.checksRemaining = checks.remaining;
summary_checks.dataset.checksTotal = checks.total;
summary_checks.textContent = `Checks: ${parseInt(checks.collected + checks.found)}/${
checks.total
} (${checks.remaining})`;
summary_checks.textContent = `Checks: ${parseInt(
checks.collected + checks.found
)}/${checks.total} (${checks.remaining})`;
const summary_entrances = summary_element.querySelector(".summary-entrances");
summary_entrances.dataset.entrancesFound = entrances.found;
@ -786,18 +788,22 @@ async function update_summary(scene, checks, entrances) {
// Make variables for whether checks or entrances updated
const checks_changed =
summary_checks.dataset.checksCollected != parseInt(checks.collected + checks.found);
parseInt(summary_checks.dataset.checksCollected) !=
parseInt(checks.collected + checks.found);
const entrances_changed =
summary_entrances.dataset.entrancesFound != entrances.found;
parseInt(summary_entrances.dataset.entrancesFound) !=
parseInt(entrances.found);
// Check for changes, and if so, update
if (checks_changed) {
summary_checks.dataset.checksCollected = parseInt(checks.collected + checks.found);
summary_checks.dataset.checksCollected = parseInt(
checks.collected + checks.found
);
summary_checks.dataset.checksRemaining = checks.remaining;
summary_checks.dataset.checksTotal = checks.total;
summary_checks.textContent = `Checks: ${parseInt(checks.collected + checks.found)}/${
checks.total
} (${checks.remaining})`;
summary_checks.textContent = `Checks: ${parseInt(
checks.collected + checks.found
)}/${checks.total} (${checks.remaining})`;
}
if (entrances_changed) {
summary_entrances.dataset.entrancesFound = entrances.found;
@ -849,6 +855,7 @@ async function update_summary_list(data, changed) {
collected: document.querySelector(
`.summary[data-scene="${scene}"] .summary-checks`
).dataset.checksCollected,
found: 0,
remaining: document.querySelector(
`.summary[data-scene="${scene}"] .summary-checks`
).dataset.checksRemaining,