plugin-backend #1
@ -728,12 +728,14 @@ 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(checks.collected + checks.found);
|
summary_checks.dataset.checksCollected = parseInt(
|
||||||
|
checks.collected + 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(checks.collected + checks.found)}/${
|
summary_checks.textContent = `Checks: ${parseInt(
|
||||||
checks.total
|
checks.collected + checks.found
|
||||||
} (${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;
|
||||||
@ -786,18 +788,22 @@ 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 =
|
||||||
summary_checks.dataset.checksCollected != parseInt(checks.collected + checks.found);
|
parseInt(summary_checks.dataset.checksCollected) !=
|
||||||
|
parseInt(checks.collected + checks.found);
|
||||||
const entrances_changed =
|
const entrances_changed =
|
||||||
summary_entrances.dataset.entrancesFound != entrances.found;
|
parseInt(summary_entrances.dataset.entrancesFound) !=
|
||||||
|
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(checks.collected + checks.found);
|
summary_checks.dataset.checksCollected = parseInt(
|
||||||
|
checks.collected + 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(checks.collected + checks.found)}/${
|
summary_checks.textContent = `Checks: ${parseInt(
|
||||||
checks.total
|
checks.collected + checks.found
|
||||||
} (${checks.remaining})`;
|
)}/${checks.total} (${checks.remaining})`;
|
||||||
}
|
}
|
||||||
if (entrances_changed) {
|
if (entrances_changed) {
|
||||||
summary_entrances.dataset.entrancesFound = entrances.found;
|
summary_entrances.dataset.entrancesFound = entrances.found;
|
||||||
@ -849,6 +855,7 @@ async function update_summary_list(data, changed) {
|
|||||||
collected: document.querySelector(
|
collected: document.querySelector(
|
||||||
`.summary[data-scene="${scene}"] .summary-checks`
|
`.summary[data-scene="${scene}"] .summary-checks`
|
||||||
).dataset.checksCollected,
|
).dataset.checksCollected,
|
||||||
|
found: 0,
|
||||||
remaining: document.querySelector(
|
remaining: document.querySelector(
|
||||||
`.summary[data-scene="${scene}"] .summary-checks`
|
`.summary[data-scene="${scene}"] .summary-checks`
|
||||||
).dataset.checksRemaining,
|
).dataset.checksRemaining,
|
||||||
|
Loading…
Reference in New Issue
Block a user