From 7f66116cd546cc9981a14562b9cab04e719d9066 Mon Sep 17 00:00:00 2001
From: Krzysztof kuhy Rudnicki
Date: Sun, 30 Aug 2026 22:57:45 +0200
Subject: [PATCH] fix: the tagger ends on a screen, not on a button that stops
working
Clicking "dalej" on the last photo did nothing, because move() clamped at
the end. Everything had in fact been saved -- each toggle writes tags.json
on the spot -- but the only way to find that out was to stop the tagger and
read its summary, so the last photo answered "did that work?" with silence.
The end of the album is now a screen: it says Gotowe, prints how many photos
each command has, and offers a way back into the photos.
The counts are distinct files rather than a sum per reading. A photo showing
two of the three people an "either of them" entry covers is one photo that
command can return, and summing claimed it twice.
Co-Authored-By: Claude Opus 5 (1M context)
Claude-Session: https://claude.ai/code/session_017w1HZ3cZ7neL3rFdQ6VMBA
---
tool/tagger.html | 26 +++++++++++++++++++++++++-
tool/tagger.py | 17 +++++++++++++----
2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/tool/tagger.html b/tool/tagger.html
index 42b7f02..5b4d36b 100644
--- a/tool/tagger.html
+++ b/tool/tagger.html
@@ -57,6 +57,13 @@ ktokolwiek = ala | marek ← losowo jedno z nich
+
+
Gotowe.
+
Wszystko zapisane. Komendy i ile mają zdjęć:
+
+
+
+
@@ -168,11 +175,23 @@ async function toggle(k) {
setTimeout(() => { document.getElementById("saved").textContent = ""; }, 800);
}
-function move(step) {
+async function move(step) {
+ if (step > 0 && at === state.files.length - 1) {
+ // The end of the album is a screen, not a button that stops working.
+ await finish();
+ return;
+ }
at = Math.min(state.files.length - 1, Math.max(0, at + step));
draw();
}
+async function finish() {
+ const {lines} = await api("/api/summary");
+ document.getElementById("counts").textContent = lines.join("\n");
+ document.getElementById("tagger").hidden = true;
+ document.getElementById("done").hidden = false;
+}
+
document.addEventListener("keydown", (event) => {
if (document.getElementById("tagger").hidden) { return; }
if (event.key === "ArrowRight" || event.key === "Enter") { move(1); }
@@ -210,6 +229,11 @@ async function start() {
document.getElementById("prev").onclick = () => move(-1);
document.getElementById("next").onclick = () => move(1);
+document.getElementById("again").onclick = () => {
+ document.getElementById("done").hidden = true;
+ document.getElementById("tagger").hidden = false;
+ draw();
+};
start();