Tag-Ansicht: pausierte Zeiten bleiben als Verlauf stehen (verschwinden nicht mehr)
live-client loggt Pausen-Spannen (__pauseSpans: {s,e}), live.php reicht sie durch,
renderLiveSummary zeichnet jede als bleibendes halbhohes Segment im Tag-Balken
(offene/laufende Pause blinkt). Fallback fuer Sim-Pause via phase bleibt.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,8 @@
|
|||||||
var sessionCapped = false;
|
var sessionCapped = false;
|
||||||
var paused = false; // Sim-Pause: friert activeMs ein (opt-in)
|
var paused = false; // Sim-Pause: friert activeMs ein (opt-in)
|
||||||
var idleActive = false; // sichtbare Idle-Pause aktiv (Weiter-Overlay)
|
var idleActive = false; // sichtbare Idle-Pause aktiv (Weiter-Overlay)
|
||||||
|
var pauseSpans = []; // Verlauf abgeschlossener Pausen {s,e} (ms-Epoch)
|
||||||
|
var curPauseStart = 0; // Beginn der laufenden Pause (0 = keine)
|
||||||
|
|
||||||
function onInteraction() {
|
function onInteraction() {
|
||||||
lastInteractionAt = Date.now();
|
lastInteractionAt = Date.now();
|
||||||
@@ -180,6 +182,10 @@
|
|||||||
state.__capped = sessionCapped;
|
state.__capped = sessionCapped;
|
||||||
state.__paused = paused || idleActive;
|
state.__paused = paused || idleActive;
|
||||||
state.__idlePaused = idleActive;
|
state.__idlePaused = idleActive;
|
||||||
|
// Pausen-Verlauf für die Tag-Ansicht: abgeschlossene Spannen + laufende (offen).
|
||||||
|
state.__pauseSpans = curPauseStart
|
||||||
|
? pauseSpans.concat([{ s: curPauseStart, e: Date.now() }])
|
||||||
|
: pauseSpans.slice();
|
||||||
fetch(apiBase + '/live.php', {
|
fetch(apiBase + '/live.php', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
@@ -239,10 +245,16 @@
|
|||||||
function showIdlePause() {
|
function showIdlePause() {
|
||||||
if (idleActive) return;
|
if (idleActive) return;
|
||||||
idleActive = true;
|
idleActive = true;
|
||||||
|
curPauseStart = Date.now(); // Pausenbeginn merken (für den Tag-Verlauf)
|
||||||
ensureIdleOverlay().style.display = 'flex';
|
ensureIdleOverlay().style.display = 'flex';
|
||||||
}
|
}
|
||||||
function resumeFromIdle() {
|
function resumeFromIdle() {
|
||||||
idleActive = false;
|
idleActive = false;
|
||||||
|
if (curPauseStart) {
|
||||||
|
pauseSpans.push({ s: curPauseStart, e: Date.now() });
|
||||||
|
if (pauseSpans.length > 30) pauseSpans.shift(); // Deckel gegen Wildwuchs
|
||||||
|
curPauseStart = 0;
|
||||||
|
}
|
||||||
lastInteractionAt = Date.now();
|
lastInteractionAt = Date.now();
|
||||||
lastTickAt = Date.now(); // kein Zeitsprung beim Fortsetzen
|
lastTickAt = Date.now(); // kein Zeitsprung beim Fortsetzen
|
||||||
if (idleOverlay) idleOverlay.style.display = 'none';
|
if (idleOverlay) idleOverlay.style.display = 'none';
|
||||||
|
|||||||
@@ -373,6 +373,8 @@ if ($method === 'GET') {
|
|||||||
'isLive' => true,
|
'isLive' => true,
|
||||||
'paused' => $isPaused,
|
'paused' => $isPaused,
|
||||||
'activeUntilMs'=> ($activeUntil > $startMs && $activeUntil < $endMs) ? $activeUntil : 0,
|
'activeUntilMs'=> ($activeUntil > $startMs && $activeUntil < $endMs) ? $activeUntil : 0,
|
||||||
|
// Pausen-Verlauf (bleibt im Tag-Balken stehen, auch nach dem Fortsetzen).
|
||||||
|
'pauseSpans' => (isset($state['__pauseSpans']) && is_array($state['__pauseSpans'])) ? array_slice($state['__pauseSpans'], -30) : [],
|
||||||
];
|
];
|
||||||
$byStudent[$sid]['totalSec'] += $durSec;
|
$byStudent[$sid]['totalSec'] += $durSec;
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-4
@@ -2282,12 +2282,27 @@ async function renderLiveSummary() {
|
|||||||
+ 'white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;'
|
+ 'white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;'
|
||||||
+ 'text-shadow:0 1px 1px rgba(0,0,0,.3);box-shadow:0 1px 2px rgba(0,0,0,.12)">'
|
+ 'text-shadow:0 1px 1px rgba(0,0,0,.3);box-shadow:0 1px 2px rgba(0,0,0,.12)">'
|
||||||
+ inner + '</div>';
|
+ inner + '</div>';
|
||||||
// Pausen-Schwanz: halbhoch, gedämpft, blinkt langsam — „läuft noch, aber gerade ruhig".
|
// Pausen im Verlauf: jede geloggte Pausen-Spanne bleibt als halbhohes,
|
||||||
if (isPausedRun) {
|
// gedämpftes Segment im Balken stehen — auch nachdem die Schüler:in wieder
|
||||||
var halfH = 9;
|
// weiterarbeitet. So sieht man, WANN und WIE LANGE pausiert wurde.
|
||||||
|
var spans = sess.pauseSpans || [];
|
||||||
|
var halfH = 9, halfTop = 5 + barH - halfH;
|
||||||
|
if (spans.length) {
|
||||||
|
spans.forEach(function(sp){
|
||||||
|
if (!sp || !sp.s || !sp.e) return;
|
||||||
|
var a = _msToPct(sp.s), b = _msToPct(sp.e);
|
||||||
|
var w = Math.max(0.4, b - a);
|
||||||
|
var live = (Math.abs(sp.e - endMs) < 6000); // die offene (laufende) Pause blinkt
|
||||||
|
html += '<div title="Pause '+_fmtHM(sp.s)+'–'+_fmtHM(sp.e)+'" '
|
||||||
|
+ 'style="position:absolute;left:'+a+'%;width:'+w+'%;top:'+halfTop+'px;height:'+halfH+'px;'
|
||||||
|
+ 'background:'+col+';opacity:.4;border-radius:2px;border:1px dashed rgba(255,255,255,.55);'
|
||||||
|
+ (live?'animation:_tagblink 2.4s ease-in-out infinite;':'')+'"></div>';
|
||||||
|
});
|
||||||
|
} else if (isPausedRun) {
|
||||||
|
// Fallback ohne geloggte Spannen (z. B. Sim-Pause via phase): aktueller Schwanz.
|
||||||
var tailW = Math.max(0.6, _msToPct(endMs) - pctR);
|
var tailW = Math.max(0.6, _msToPct(endMs) - pctR);
|
||||||
html += '<div title="pausiert seit '+_fmtHM(mainEndMs)+'" '
|
html += '<div title="pausiert seit '+_fmtHM(mainEndMs)+'" '
|
||||||
+ 'style="position:absolute;left:'+pctR+'%;width:'+tailW+'%;top:'+(5+barH-halfH)+'px;height:'+halfH+'px;'
|
+ 'style="position:absolute;left:'+pctR+'%;width:'+tailW+'%;top:'+halfTop+'px;height:'+halfH+'px;'
|
||||||
+ 'background:'+col+';opacity:.42;border-radius:0 3px 3px 0;'
|
+ 'background:'+col+';opacity:.42;border-radius:0 3px 3px 0;'
|
||||||
+ 'border:1px dashed rgba(255,255,255,.6);animation:_tagblink 2.4s ease-in-out infinite"></div>';
|
+ 'border:1px dashed rgba(255,255,255,.6);animation:_tagblink 2.4s ease-in-out infinite"></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user