plugin-backend #1

Merged
ada merged 34 commits from plugin-backend into main 2024-05-01 00:21:12 -05:00
5 changed files with 24 additions and 17 deletions
Showing only changes of commit b8c4dbe022 - Show all commits

View File

@ -1,10 +1,12 @@
{
"collected": 0,
"found": 0,
"remaining": 0,
"total": 1312,
"scenes": {
"mystery": {
"collected": 0,
"found": 0,
"remaining": 0,
"total": 0,
"checks": {
@ -13,6 +15,7 @@
},
"Another One": {
"collected": 69,
"found": 0,
"remaining": 0,
"total": 420,
"checks": {

View File

@ -81,7 +81,7 @@ async function initialize_elements() {
// Initialize global state
current_checks = checks.collected;
current_checks = checks.collected + checks.found;
current_entrances = entrances.found;
total_checks = checks.total;
total_entrances = entrances.total;
@ -574,10 +574,10 @@ async function initialize_checks_list(checks_list, checks) {
// Update the check totals
checks_list.querySelector(
".breakdown-block-checks-title"
).textContent = `Checks: ${checks.collected}/${checks.total} (${checks.remaining} left)`;
).textContent = `Checks: ${checks.collected + checks.found}/${checks.total} (${checks.remaining} left)`;
checks_list.querySelector(
".breakdown-block-checks-title"
).dataset.checksCollected = checks.collected;
).dataset.checksCollected = checks.collected + checks.found;
checks_list.querySelector(
".breakdown-block-checks-title"
).dataset.checksRemaining = checks.remaining;
@ -722,10 +722,10 @@ 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 = checks.collected;
summary_checks.dataset.checksCollected = checks.collected + checks.found;
summary_checks.dataset.checksRemaining = checks.remaining;
summary_checks.dataset.checksTotal = checks.total;
summary_checks.textContent = `Checks: ${checks.collected}/${checks.total} (${checks.remaining})`;
summary_checks.textContent = `Checks: ${checks.collected + checks.found}/${checks.total} (${checks.remaining})`;
const summary_entrances = summary_element.querySelector(".summary-entrances");
summary_entrances.dataset.entrancesFound = entrances.found;
@ -737,7 +737,7 @@ async function initialize_summary(summary_element, scene, checks, entrances) {
summary_element.firstElementChild.replaceWith(
await apply_summary_colors({
element: summary_element.firstElementChild,
checks_collected: checks.collected,
checks_collected: checks.collected + checks.found,
checks_remaining: checks.remaining,
checks_total: checks.total,
entrances_found: entrances.found,
@ -778,16 +778,16 @@ async function update_summary(scene, checks, entrances) {
// Make variables for whether checks or entrances updated
const checks_changed =
summary_checks.dataset.checksCollected != checks.collected;
summary_checks.dataset.checksCollected != checks.collected + checks.found;
const entrances_changed =
summary_entrances.dataset.entrancesFound != entrances.found;
// Check for changes, and if so, update
if (checks_changed) {
summary_checks.dataset.checksCollected = checks.collected;
summary_checks.dataset.checksCollected = checks.collected + checks.found;
summary_checks.dataset.checksRemaining = checks.remaining;
summary_checks.dataset.checksTotal = checks.total;
summary_checks.textContent = `Checks: ${checks.collected}/${checks.total} (${checks.remaining})`;
summary_checks.textContent = `Checks: ${checks.collected + checks.found}/${checks.total} (${checks.remaining})`;
}
if (entrances_changed) {
summary_entrances.dataset.entrancesFound = entrances.found;
@ -804,7 +804,7 @@ async function update_summary(scene, checks, entrances) {
await apply_summary_colors({
element: document.querySelector(`.summary[data-scene="${scene}"]`)
.firstElementChild,
checks_collected: checks.collected,
checks_collected: checks.collected + checks.found,
checks_remaining: checks.remaining,
checks_total: checks.total,
entrances_found: entrances.found,
@ -856,10 +856,10 @@ async function update_breakdown_checks(scene, checks) {
// Update the check totals
document.querySelector(
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
).textContent = `Checks: ${checks.collected}/${checks.total} (${checks.remaining} left)`;
).textContent = `Checks: ${checks.collected + checks.found}/${checks.total} (${checks.remaining} left)`;
document.querySelector(
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
).dataset.checksCollected = checks.collected;
).dataset.checksCollected = checks.collected + checks.found;
document.querySelector(
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
).dataset.checksRemaining = checks.remaining;
@ -925,7 +925,7 @@ async function update_breakdown(scene, checks, entrances) {
);
// Check for changes, and if so, update
if (breakdown_checks.dataset.checksCollected != checks.collected) {
if (breakdown_checks.dataset.checksCollected != checks.collected + checks.found) {
update_breakdown_checks(scene, checks);
}
if (breakdown_entrances.dataset.entrancesFound != entrances.found) {

View File

@ -3,14 +3,14 @@
onclick="open_breakdown(this)"
data-scene="{{ scene }}">
<div class="p-2 *:mr-auto *:justify-start *:text-left min-h-full flex flex-col rounded-lg bg-gradient-to-tl shadow-sm shadow-[#242424] {{ extra_classes }}">
<div class="summary-title">{{ scene }}:</div>
<div class="summary-checks"
<div class="text-sm md:text-base summary-title">{{ scene }}:</div>
<div class="text-xs summary-checks"
data-checks-collected="{{ scene_data.checks.collected }}"
data-checks-remaining="{{ scene_data.checks.remaining }}"
data-checks-total="{{ scene_data.checks.total }}">
Checks: {{ scene_data.checks.collected }}/{{ scene_data.checks.total }} ({{ scene_data.checks.remaining }})
</div>
<div class="summary-entrances"
<div class="text-xs summary-entrances"
data-entrances-found="{{ scene_data.entrances.found }}"
data-entrances-remaining="{{ scene_data.entrances.remaining }}"
data-entrances-total="{{ scene_data.entrances.total }}">

View File

@ -4,7 +4,7 @@
<div class="p-2 rounded-xl">
<div class="p-2 rounded-md bg-gradient-to-br from-charcoal-translucent to-charcoal-translucent-light"
id="summary-list">
<div class="grid grid-flow-row gap-2 p-1 overflow-y-scroll md:grid-cols-3 xl:grid-cols-5 max-h-96 rounded-xl scrollbar-none">
<div class="grid grid-flow-row grid-cols-2 gap-2 p-1 overflow-y-scroll md:grid-cols-3 xl:grid-cols-5 rounded-xl scrollbar-none">
{% include "tracker/summary/block.html" with extra_classes="" is_hidden="hidden" %}
{% for scene, scene_data in scenes.items %}
{% if scene != "Posterity" and scene != "Resurrection" and scene != "Loading" %}

View File

@ -115,6 +115,10 @@ def index(request):
"entrances": tracker_doors_data["scenes"][scene],
"checks": tracker_items_data["scenes"][scene],
}
scene_data[scene]["checks"]["collected"] = (
scene_data[scene]["checks"]["collected"]
+ scene_data[scene]["checks"]["found"]
)
template = loader.get_template("tracker/index.html")
server_address_form = ServerAddressForm()