From 4c75a3218614537a9cbe739b41a8524060aad5f0 Mon Sep 17 00:00:00 2001 From: Adriano Dal Pastro Date: Fri, 5 Jun 2026 09:30:52 +0000 Subject: [PATCH] fix(measure): START cycle advances to next task instead of blocking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When all subtasks of a task were measured, the completion overlay only offered "Riepilogo" (which leaves the work cycle) or "Conferma ciclo" (which keeps the operator stuck on the same task and starts the interval timer). During the START run — before production is started — neither lets the operator simply move to the next task. Make the overlay phase-aware: - Production started: keep "Conferma ciclo". - START, not the last task: primary action "Task successivo" -> goToNextTask(). - START, last task: "Avvio Produzione" -> startProductionFromOverlay(), which starts production and kicks off the interval cycle. Add isLastTask getter and startProductionFromOverlay(); EN translation for the new label. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../templates/measure/task_execute.html | 44 ++++++++++++++++++- .../translations/en/LC_MESSAGES/messages.po | 3 ++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/frontend/flask_app/templates/measure/task_execute.html b/src/frontend/flask_app/templates/measure/task_execute.html index 0ab1f52..4dabd82 100644 --- a/src/frontend/flask_app/templates/measure/task_execute.html +++ b/src/frontend/flask_app/templates/measure/task_execute.html @@ -584,13 +584,36 @@ class="btn btn-secondary flex-1 justify-center gap-2"> {{ _('Riepilogo') }} - + + {# START phase, more tasks to go: advance without blocking or exiting #} + + + {# START phase, last task: start production #} + @@ -980,6 +1003,25 @@ function taskExecute() { // await fetch('/measure/api/gaia/start-production', { method: 'POST', ... }); }, + // Is the current task the last one in the recipe sequence? + get isLastTask() { + const taskIds = window.__allTaskIds || []; + const idx = taskIds.indexOf(this.task.id); + return idx === -1 || idx >= taskIds.length - 1; + }, + + // Start production from the completion overlay (last START task) and begin + // the measurement-interval cycle if the recipe defines one. + startProductionFromOverlay() { + this.showCompletionOverlay = false; + this.startProduction(); + this.cycleConfirmed = true; + this.cycleCount++; + if (this.measurementIntervalMinutes && this.measurementIntervalMinutes > 0) { + this.startMeasurementTimer(); + } + }, + get timerDisplay() { var m = Math.floor(this.timerRemaining / 60); var s = this.timerRemaining % 60; diff --git a/src/frontend/flask_app/translations/en/LC_MESSAGES/messages.po b/src/frontend/flask_app/translations/en/LC_MESSAGES/messages.po index 91a7590..90bcd1a 100644 --- a/src/frontend/flask_app/translations/en/LC_MESSAGES/messages.po +++ b/src/frontend/flask_app/translations/en/LC_MESSAGES/messages.po @@ -2188,3 +2188,6 @@ msgstr "E.g. SN-000123 (optional)" msgid "Supervisor (capoturno)" msgstr "Supervisor (shift leader)" +msgid "Task successivo" +msgstr "Next task" +