Fixed a formatting issue with the parseInt statements that was sometimes causing strings of "#collected" and "#found" to be concatenated instead of parsed and added.
This commit is contained in:
parent
9f37ae967c
commit
d24cde159a
@ -80,7 +80,7 @@ async function initialize_elements() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize global state
|
// Initialize global state
|
||||||
current_checks = parseInt(checks.collected + checks.found);
|
current_checks = parseInt(checks.collected) + parseInt(checks.found);
|
||||||
current_entrances = entrances.found;
|
current_entrances = entrances.found;
|
||||||
total_checks = checks.total;
|
total_checks = checks.total;
|
||||||
total_entrances = entrances.total;
|
total_entrances = entrances.total;
|
||||||
@ -578,12 +578,13 @@ async function initialize_checks_list(checks_list, checks) {
|
|||||||
// Update the check totals
|
// Update the check totals
|
||||||
checks_list.querySelector(
|
checks_list.querySelector(
|
||||||
".breakdown-block-checks-title"
|
".breakdown-block-checks-title"
|
||||||
).textContent = `Checks: ${parseInt(checks.collected + checks.found)}/${
|
).textContent = `Checks: ${
|
||||||
checks.total
|
parseInt(checks.collected) + parseInt(checks.found)
|
||||||
} (${checks.remaining} left)`;
|
}/${checks.total} (${checks.remaining} left)`;
|
||||||
checks_list.querySelector(
|
checks_list.querySelector(
|
||||||
".breakdown-block-checks-title"
|
".breakdown-block-checks-title"
|
||||||
).dataset.checksCollected = parseInt(checks.collected + checks.found);
|
).dataset.checksCollected =
|
||||||
|
parseInt(checks.collected) + parseInt(checks.found);
|
||||||
checks_list.querySelector(
|
checks_list.querySelector(
|
||||||
".breakdown-block-checks-title"
|
".breakdown-block-checks-title"
|
||||||
).dataset.checksRemaining = checks.remaining;
|
).dataset.checksRemaining = checks.remaining;
|
||||||
@ -728,14 +729,13 @@ async function initialize_summary(summary_element, scene, checks, entrances) {
|
|||||||
summary_element.querySelector(".summary-title").textContent = scene;
|
summary_element.querySelector(".summary-title").textContent = scene;
|
||||||
|
|
||||||
const summary_checks = summary_element.querySelector(".summary-checks");
|
const summary_checks = summary_element.querySelector(".summary-checks");
|
||||||
summary_checks.dataset.checksCollected = parseInt(
|
summary_checks.dataset.checksCollected =
|
||||||
checks.collected + checks.found
|
parseInt(checks.collected) + parseInt(checks.found);
|
||||||
);
|
|
||||||
summary_checks.dataset.checksRemaining = checks.remaining;
|
summary_checks.dataset.checksRemaining = checks.remaining;
|
||||||
summary_checks.dataset.checksTotal = checks.total;
|
summary_checks.dataset.checksTotal = checks.total;
|
||||||
summary_checks.textContent = `Checks: ${parseInt(
|
summary_checks.textContent = `Checks: ${
|
||||||
checks.collected + checks.found
|
parseInt(checks.collected) + parseInt(checks.found)
|
||||||
)}/${checks.total} (${checks.remaining})`;
|
}/${checks.total} (${checks.remaining})`;
|
||||||
|
|
||||||
const summary_entrances = summary_element.querySelector(".summary-entrances");
|
const summary_entrances = summary_element.querySelector(".summary-entrances");
|
||||||
summary_entrances.dataset.entrancesFound = entrances.found;
|
summary_entrances.dataset.entrancesFound = entrances.found;
|
||||||
@ -747,7 +747,7 @@ async function initialize_summary(summary_element, scene, checks, entrances) {
|
|||||||
summary_element.firstElementChild.replaceWith(
|
summary_element.firstElementChild.replaceWith(
|
||||||
await apply_summary_colors({
|
await apply_summary_colors({
|
||||||
element: summary_element.firstElementChild,
|
element: summary_element.firstElementChild,
|
||||||
checks_collected: parseInt(checks.collected + checks.found),
|
checks_collected: parseInt(checks.collected) + parseInt(checks.found),
|
||||||
checks_remaining: checks.remaining,
|
checks_remaining: checks.remaining,
|
||||||
checks_total: checks.total,
|
checks_total: checks.total,
|
||||||
entrances_found: entrances.found,
|
entrances_found: entrances.found,
|
||||||
@ -789,21 +789,20 @@ async function update_summary(scene, checks, entrances) {
|
|||||||
// Make variables for whether checks or entrances updated
|
// Make variables for whether checks or entrances updated
|
||||||
const checks_changed =
|
const checks_changed =
|
||||||
parseInt(summary_checks.dataset.checksCollected) !=
|
parseInt(summary_checks.dataset.checksCollected) !=
|
||||||
parseInt(checks.collected + checks.found);
|
parseInt(checks.collected) + parseInt(checks.found);
|
||||||
const entrances_changed =
|
const entrances_changed =
|
||||||
parseInt(summary_entrances.dataset.entrancesFound) !=
|
parseInt(summary_entrances.dataset.entrancesFound) !=
|
||||||
parseInt(entrances.found);
|
parseInt(entrances.found);
|
||||||
|
|
||||||
// Check for changes, and if so, update
|
// Check for changes, and if so, update
|
||||||
if (checks_changed) {
|
if (checks_changed) {
|
||||||
summary_checks.dataset.checksCollected = parseInt(
|
summary_checks.dataset.checksCollected =
|
||||||
checks.collected + checks.found
|
parseInt(checks.collected) + parseInt(checks.found);
|
||||||
);
|
|
||||||
summary_checks.dataset.checksRemaining = checks.remaining;
|
summary_checks.dataset.checksRemaining = checks.remaining;
|
||||||
summary_checks.dataset.checksTotal = checks.total;
|
summary_checks.dataset.checksTotal = checks.total;
|
||||||
summary_checks.textContent = `Checks: ${parseInt(
|
summary_checks.textContent = `Checks: ${
|
||||||
checks.collected + checks.found
|
parseInt(checks.collected) + parseInt(checks.found)
|
||||||
)}/${checks.total} (${checks.remaining})`;
|
}/${checks.total} (${checks.remaining})`;
|
||||||
}
|
}
|
||||||
if (entrances_changed) {
|
if (entrances_changed) {
|
||||||
summary_entrances.dataset.entrancesFound = entrances.found;
|
summary_entrances.dataset.entrancesFound = entrances.found;
|
||||||
@ -820,7 +819,7 @@ async function update_summary(scene, checks, entrances) {
|
|||||||
await apply_summary_colors({
|
await apply_summary_colors({
|
||||||
element: document.querySelector(`.summary[data-scene="${scene}"]`)
|
element: document.querySelector(`.summary[data-scene="${scene}"]`)
|
||||||
.firstElementChild,
|
.firstElementChild,
|
||||||
checks_collected: parseInt(checks.collected + checks.found),
|
checks_collected: parseInt(checks.collected) + parseInt(checks.found),
|
||||||
checks_remaining: checks.remaining,
|
checks_remaining: checks.remaining,
|
||||||
checks_total: checks.total,
|
checks_total: checks.total,
|
||||||
entrances_found: entrances.found,
|
entrances_found: entrances.found,
|
||||||
@ -873,12 +872,13 @@ async function update_breakdown_checks(scene, checks) {
|
|||||||
// Update the check totals
|
// Update the check totals
|
||||||
document.querySelector(
|
document.querySelector(
|
||||||
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
||||||
).textContent = `Checks: ${parseInt(checks.collected + checks.found)}/${
|
).textContent = `Checks: ${
|
||||||
checks.total
|
parseInt(checks.collected) + parseInt(checks.found)
|
||||||
} (${checks.remaining} left)`;
|
}/${checks.total} (${checks.remaining} left)`;
|
||||||
document.querySelector(
|
document.querySelector(
|
||||||
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
||||||
).dataset.checksCollected = parseInt(checks.collected + checks.found);
|
).dataset.checksCollected =
|
||||||
|
parseInt(checks.collected) + parseInt(checks.found);
|
||||||
document.querySelector(
|
document.querySelector(
|
||||||
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
||||||
).dataset.checksRemaining = checks.remaining;
|
).dataset.checksRemaining = checks.remaining;
|
||||||
@ -946,7 +946,7 @@ async function update_breakdown(scene, checks, entrances) {
|
|||||||
// Check for changes, and if so, update
|
// Check for changes, and if so, update
|
||||||
if (
|
if (
|
||||||
parseInt(breakdown_checks.dataset.checksCollected) !=
|
parseInt(breakdown_checks.dataset.checksCollected) !=
|
||||||
parseInt(checks.collected + checks.found)
|
parseInt(checks.collected) + parseInt(checks.found)
|
||||||
) {
|
) {
|
||||||
update_breakdown_checks(scene, checks);
|
update_breakdown_checks(scene, checks);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user