feat(reception): add distinct warning color for students without classes and scan alert interactions (v3.8.51)

This commit is contained in:
2026-10-28 14:33:07 -03:00
parent 9f21442bed
commit 1477780df0
7 changed files with 163 additions and 33 deletions
+14
View File
@@ -11,6 +11,20 @@ El formato está basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1
- **Sincronización Continua Moodle (Fase 6):** Automatización de workers persistentes en background para el procesamiento continuo de la cola de Web Services Moodle 4.1.
- **Pruebas de Carga y Hardening (Fase 6):** Pruebas de estrés de concurrencia y validación final de producción.
## [3.8.51] - 2026-10-28
### Added & Improved (Alerta Visual Ámbar sin Clases Hoy e Interacciones de Detección de Nuevo Escaneo en Recepción)
- **Diferenciación Cromática por Cursada del Día (`/reception/scanner`)**:
- Se implementó un esquema de color diferenciado cuando el alumno/titular está activo/regular pero **no tiene clases presenciales programadas para la fecha**:
- **Cuadro con Cursada Hoy**: Borde verde `border-success`, cabecera verde esmeralda y badge "Tiene Cursada".
- **Cuadro sin Cursada Hoy**: Borde ámbar `border-warning`, fondo suave `#FFFDF5`, cabecera ámbar de advertencia (`bg-warning text-dark fw-bold`), badge distintivo "Sin Cursada Hoy" y alerta explicativa `alert-warning` con icono de calendario tachado indicando que no tiene aula física asignada.
- **Interacción Dinámica para la Detección Inmediata de Nuevos Escaneos**:
- **Efecto de Destello / Pulso Visual**: Cada nuevo escaneo recibido re-dispara una animación CSS de resplandor (`animate-scan-success`, `animate-scan-warning` o `animate-scan-danger`) forzando reflow del DOM, lo que permite a la operadora notar el escaneo al instante incluso por visión periférica.
- **Badge Flotante Animado**: Muestra el indicador `¡Nuevo Escaneo Registrado!` (`animate-pulse-badge`) en la cabecera durante los primeros 2.5 segundos de cada lectura.
- **Feedback Auditivo Diferenciado (Web Audio API)**:
- *Tono Armónico Doble Ascendente (587Hz -> 880Hz)*: Cuando el alumno o docente tiene clases programadas hoy con aula asignada.
- *Tono Suave Medio (440Hz -> 554Hz)*: Cuando el alumno ingresa pero no tiene clases hoy (aviso para control de Bedelía).
- *Tono Grave de Alerta (220Hz)*: Ante accesos denegados, credenciales expiradas o no registradas.
## [3.8.50] - 2026-10-28
### Added & Changed (Depuración de Sedes Físicas en Recepción, Eliminación de Cámara y Especificación SDD-013 Web Serial COM)
- **Depuración de Sedes en la Consola de Recepción**:
+4 -3
View File
@@ -9,11 +9,12 @@ Memoria del proyecto entre sesiones para la rama `dev`.
- Libro de Calificaciones (*Gradebook*) con actas de regularidad inmutables.
- Autenticación híbrida (Google OAuth 2.0, Moodle SSO, Local) y Modo Impersonación.
- Reinicialización segura del sistema con contraseña de Administrador.
- **Sprint Activo: Consola de Recepción Presencial y Lector por Puerto Serie (v3.8.50)**:
- **Sprint Activo: Consola de Recepción Presencial, Alertas de Cursada y Puerto Serie (v3.8.51)**:
- **Sede Física Exclusiva y Edificio Central Predeterminado**: Filtrado total de sedes virtuales en `/reception/scanner`. Edificio Central fijado como sede predeterminada de control de acceso.
- **Depuración de Cámara Web**: Removido el visor de cámara y la dependencia de `html5-qrcode`, consolidando la consola en modo lector óptico / pistola de alta velocidad.
- **Diferenciación Cromática por Cursada**: Alumnos con cursada hoy se despliegan en verde esmeralda con badge "Tiene Cursada". Alumnos regulares sin clases hoy se destacan en cuadro de advertencia ámbar/amarillo cálido (`#FFFDF5`), badge "Sin Cursada Hoy" y banner explicativo con icono de calendario tachado.
- **Interacciones de Detección de Nuevo Escaneo**: Resplandor dinámico visual en el contenedor (`animate-scan-*`), badge flotante de alerta `¡Nuevo Escaneo Registrado!` y tonos auditivos diferenciados vía Web Audio API (doble agudo para cursada asignada, tono medio suave para regular sin cursada, y grave de alerta para accesos no autorizados).
- **Especificación e Integración SDD-013 (Web Serial COM en Chromium/Windows)**: Especificación formal completa en `specs/013-escaner-qr-puerto-com-serial/` y módulo `serial-scanner.js` para captura directa asíncrona desde puertos COM (`navigator.serial`) sin requerir foco en el cursor.
- **Versión Consolidada**: `v3.8.50`.
- **Versión Consolidada**: `v3.8.51`.
## Decisiones (y por qué)
- **Flujo Secuencial de Bedelía (9 Pasos)**: Estandarizar la carga operativa en: 1) Sede -> 2) Aula -> 3) Ciclo Lectivo -> 4) Carrera -> 5) Materia (vinculada a Carrera) -> 6) Comisión (asociada a Materia, Carrera y Ciclo) -> 7) Profesores -> 8) Alumnos -> 9) Reserva de Espacio. Esto asegura consistencia e integridad relacional.
+1 -1
View File
@@ -7,7 +7,7 @@ from typing import Any
from database import db, get_db, engine, SessionLocal, session
from config.config import Config
__version__ = "3.8.50"
__version__ = "3.8.51"
class DummyContext:
def __enter__(self):
+1 -1
View File
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="edu-space-admin",
version="3.8.50",
version="3.8.51",
description="Administrative interface for Edu-Space Classroom Management System (FastAPI ASGI Core)",
author="Edu-Space Development Team",
author_email="admin@edu-space.com",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "3.8.50",
"version": "3.8.51",
"description": "",
"main": "index.js",
"scripts": {
+3 -3
View File
@@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
});
// Versiones institucionales del sistema
const APP_VERSION = '3.8.50';
const FRONTEND_VERSION = '3.8.50';
const BACKEND_VERSION = '3.8.50';
const APP_VERSION = '3.8.51';
const FRONTEND_VERSION = '3.8.51';
const BACKEND_VERSION = '3.8.51';
env.addGlobal('app_version', APP_VERSION);
env.addGlobal('frontend_version', FRONTEND_VERSION);
+139 -24
View File
@@ -102,11 +102,16 @@
<div class="col-12 col-lg-7">
<!-- Tarjeta de Resultado en Pantalla Completa -->
<div class="card border-0 shadow-sm rounded-4 overflow-hidden mb-4" id="resultCard" style="min-height: 380px;">
<div class="card-header py-3 px-4 bg-light border-0 d-flex align-items-center justify-content-between" id="resultHeader">
<div class="card-header py-3 px-4 bg-light border-0 d-flex align-items-center justify-content-between transition-all" id="resultHeader">
<h5 class="fw-bold mb-0" id="resultStatusText">
<i class="bi bi-person-badge me-2 text-muted"></i> Esperando lectura...
</h5>
<span class="badge bg-secondary rounded-pill px-3 py-1" id="resultTimeBadge">--:--</span>
<div class="d-flex align-items-center gap-2">
<span class="badge bg-white text-dark border shadow-xs px-2 py-1 small rounded-pill d-none animate-pulse-badge" id="scanAlertBadge">
<i class="bi bi-lightning-charge-fill text-warning me-1"></i> ¡Nuevo Escaneo!
</span>
<span class="badge bg-secondary rounded-pill px-3 py-1 font-monospace" id="resultTimeBadge">--:--</span>
</div>
</div>
<div class="card-body p-4 d-flex flex-column justify-content-center text-center" id="resultBody">
<div class="py-5 text-muted" id="waitingState">
@@ -369,9 +374,12 @@
function displayVerificationResult(data) {
const waitingState = document.getElementById('waitingState');
const activeState = document.getElementById('activeResultState');
const resultCard = document.getElementById('resultCard');
const cardHeader = document.getElementById('resultHeader');
const statusText = document.getElementById('resultStatusText');
const timeBadge = document.getElementById('resultTimeBadge');
const matriculaBadge = document.getElementById('matriculaBadge');
const alertBadge = document.getElementById('scanAlertBadge');
waitingState.classList.add('d-none');
activeState.classList.remove('d-none');
@@ -379,21 +387,58 @@
const now = new Date();
timeBadge.innerText = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' });
// Disparar interacción visual: Flash del card para alertar a la operadora
resultCard.classList.remove('animate-scan-success', 'animate-scan-warning', 'animate-scan-danger');
void resultCard.offsetWidth; // Forzar reflow para reiniciar animación
if (alertBadge) {
alertBadge.classList.remove('d-none');
setTimeout(() => { alertBadge.classList.add('d-none'); }, 2500);
}
const hasClasses = Boolean(data.todays_classes && data.todays_classes.length > 0);
if (data.status === 'AUTORIZADO') {
cardHeader.className = 'card-header py-3 px-4 bg-success text-white border-0 d-flex align-items-center justify-content-between';
statusText.innerHTML = '<i class="bi bi-check-circle-fill me-2"></i> ACCESO AUTORIZADO';
document.getElementById('matriculaBadge').className = 'badge bg-success rounded-pill px-3 py-1 mb-1';
document.getElementById('matriculaBadge').innerText = data.matricula_status || 'ACTIVO';
if (hasClasses) {
// CASO 1: AUTORIZADO CON CLASES HOY -> VERDE INSTITUCIONAL
resultCard.className = 'card border-2 border-success shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-success';
resultCard.style.backgroundColor = '';
cardHeader.className = 'card-header py-3 px-4 bg-success text-white border-0 d-flex align-items-center justify-content-between';
statusText.innerHTML = '<i class="bi bi-check-circle-fill me-2"></i> ACCESO AUTORIZADO — TIENE CLASE HOY';
timeBadge.className = 'badge bg-white text-success rounded-pill px-3 py-1 font-monospace fw-bold';
matriculaBadge.className = 'badge bg-success rounded-pill px-3 py-1 mb-1 me-1';
matriculaBadge.innerHTML = (data.matricula_status || 'REGULAR / ACTIVO') + ' <span class="badge bg-primary text-white rounded-pill px-2 py-0 ms-1"><i class="bi bi-mortarboard-fill me-1"></i>Tiene Cursada</span>';
playAudioFeedback('SUCCESS_WITH_CLASSES');
} else {
// CASO 2: AUTORIZADO PERO SIN CLASES HOY -> ÁMBAR / AMARILLO DESTACADO
resultCard.className = 'card border-2 border-warning shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-warning';
resultCard.style.backgroundColor = '#FFFDF5';
cardHeader.className = 'card-header py-3 px-4 bg-warning text-dark border-0 d-flex align-items-center justify-content-between fw-bold';
statusText.innerHTML = '<i class="bi bi-calendar-x-fill text-dark me-2"></i> ACCESO AUTORIZADO — SIN CLASES PROGRAMADAS HOY';
timeBadge.className = 'badge bg-dark text-white rounded-pill px-3 py-1 font-monospace';
matriculaBadge.className = 'badge bg-success rounded-pill px-3 py-1 mb-1 me-1';
matriculaBadge.innerHTML = (data.matricula_status || 'REGULAR / ACTIVO') + ' <span class="badge bg-warning text-dark border border-dark-subtle rounded-pill px-2 py-0 ms-1 fw-bold"><i class="bi bi-calendar-x me-1"></i>Sin Cursada Hoy</span>';
playAudioFeedback('SUCCESS_NO_CLASSES');
}
} else if (data.status === 'RESTRINGIDO') {
cardHeader.className = 'card-header py-3 px-4 bg-warning text-dark border-0 d-flex align-items-center justify-content-between';
resultCard.className = 'card border-2 border-warning shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-warning';
resultCard.style.backgroundColor = '#FFFDF5';
cardHeader.className = 'card-header py-3 px-4 bg-warning text-dark border-0 d-flex align-items-center justify-content-between fw-bold';
statusText.innerHTML = '<i class="bi bi-exclamation-triangle-fill me-2"></i> ACCESO OBSERVADO / RESTRINGIDO';
document.getElementById('matriculaBadge').className = 'badge bg-warning text-dark rounded-pill px-3 py-1 mb-1';
document.getElementById('matriculaBadge').innerText = data.matricula_status || 'OBSERVADO';
timeBadge.className = 'badge bg-dark text-white rounded-pill px-3 py-1 font-monospace';
matriculaBadge.className = 'badge bg-warning text-dark rounded-pill px-3 py-1 mb-1';
matriculaBadge.innerText = data.matricula_status || 'OBSERVADO';
playAudioFeedback('WARNING');
} else {
// CASO 3: DENEGADO -> ROJO
resultCard.className = 'card border-2 border-danger shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-danger';
resultCard.style.backgroundColor = '';
cardHeader.className = 'card-header py-3 px-4 bg-danger text-white border-0 d-flex align-items-center justify-content-between';
statusText.innerHTML = '<i class="bi bi-x-circle-fill me-2"></i> ACCESO DENEGADO';
document.getElementById('matriculaBadge').className = 'badge bg-danger rounded-pill px-3 py-1 mb-1';
document.getElementById('matriculaBadge').innerText = data.matricula_status || 'NO REGISTRADO';
timeBadge.className = 'badge bg-white text-danger rounded-pill px-3 py-1 font-monospace fw-bold';
matriculaBadge.className = 'badge bg-danger rounded-pill px-3 py-1 mb-1';
matriculaBadge.innerText = data.matricula_status || 'NO REGISTRADO';
playAudioFeedback('DENIED');
}
document.getElementById('userNameText').innerText = data.user_name || 'Desconocido';
@@ -404,7 +449,7 @@
// Renderizado del cronograma de aulas de hoy
const classesContainer = document.getElementById('classesContainer');
if (data.todays_classes && data.todays_classes.length > 0) {
if (hasClasses) {
classesContainer.innerHTML = data.todays_classes.map(c => `
<div class="card border border-primary-subtle rounded-3 p-3 mb-2 bg-white shadow-sm">
<div class="d-flex align-items-start justify-content-between">
@@ -431,8 +476,16 @@
`).join('');
} else {
classesContainer.innerHTML = `
<div class="alert alert-secondary py-2 px-3 rounded-3 small mb-0">
<i class="bi bi-info-circle me-1"></i> No tiene clases presenciales programadas para el día de hoy.
<div class="alert alert-warning border border-warning-subtle text-dark p-3 rounded-4 mb-0 shadow-xs">
<div class="d-flex align-items-center gap-3">
<div class="rounded-circle bg-warning text-dark p-2 d-flex align-items-center justify-content-center shadow-xs" style="width: 42px; height: 42px;">
<i class="bi bi-calendar-x-fill fs-5"></i>
</div>
<div>
<div class="fw-bold fs-6 text-dark">No registra clases presenciales programadas para hoy</div>
<div class="small text-muted">El alumno/docente ingresa a la sede pero no tiene aula asignada para la fecha actual.</div>
</div>
</div>
</div>
`;
}
@@ -483,18 +536,51 @@
}
}
// Feedback sonoro opcional vía Web Audio API
function playBeep(success) {
// Feedback sonoro avanzado vía Web Audio API diferenciado por resultado
function playAudioFeedback(type) {
try {
const ctx = new (window.AudioContext || window.webkitAudioContext)();
const osc = ctx.createOscillator();
const gain = ctx.createGain();
osc.connect(gain);
gain.connect(ctx.destination);
osc.frequency.value = success ? 880 : 330;
gain.gain.value = 0.1;
osc.start();
setTimeout(() => { osc.stop(); }, 120);
const now = ctx.currentTime;
if (type === 'SUCCESS_WITH_CLASSES') {
// Tono doble ascendente armónico (D5 -> A5): Éxito con aula asignada
const osc1 = ctx.createOscillator();
const gain1 = ctx.createGain();
osc1.type = 'sine';
osc1.frequency.setValueAtTime(587.33, now); // D5
osc1.frequency.setValueAtTime(880.00, now + 0.08); // A5
gain1.gain.setValueAtTime(0.12, now);
gain1.gain.exponentialRampToValueAtTime(0.001, now + 0.25);
osc1.connect(gain1);
gain1.connect(ctx.destination);
osc1.start(now);
osc1.stop(now + 0.25);
} else if (type === 'SUCCESS_NO_CLASSES') {
// Tono doble suave (A4 -> C#5): Alumno regular pero sin cursada hoy
const osc2 = ctx.createOscillator();
const gain2 = ctx.createGain();
osc2.type = 'triangle';
osc2.frequency.setValueAtTime(440.00, now); // A4
osc2.frequency.setValueAtTime(554.37, now + 0.09); // C#5
gain2.gain.setValueAtTime(0.10, now);
gain2.gain.exponentialRampToValueAtTime(0.001, now + 0.24);
osc2.connect(gain2);
gain2.connect(ctx.destination);
osc2.start(now);
osc2.stop(now + 0.24);
} else {
// Tono grave de alerta (A3): Acceso denegado o restringido
const osc3 = ctx.createOscillator();
const gain3 = ctx.createGain();
osc3.type = 'sawtooth';
osc3.frequency.setValueAtTime(220.00, now);
gain3.gain.setValueAtTime(0.15, now);
gain3.gain.exponentialRampToValueAtTime(0.001, now + 0.3);
osc3.connect(gain3);
gain3.connect(ctx.destination);
osc3.start(now);
osc3.stop(now + 0.3);
}
} catch (e) {}
}
@@ -544,5 +630,34 @@
70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
/* Animaciones de detección de nuevo escaneo para la operadora */
@keyframes scan-flash-success {
0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8); }
50% { transform: scale(1.02); box-shadow: 0 0 35px 8px rgba(34, 197, 94, 0.5); }
100% { transform: scale(1); box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12); }
}
@keyframes scan-flash-warning {
0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8); }
50% { transform: scale(1.02); box-shadow: 0 0 35px 8px rgba(245, 158, 11, 0.5); }
100% { transform: scale(1); box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12); }
}
@keyframes scan-flash-danger {
0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
50% { transform: scale(1.02); box-shadow: 0 0 35px 8px rgba(239, 68, 68, 0.5); }
100% { transform: scale(1); box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12); }
}
.animate-scan-success { animation: scan-flash-success 0.55s ease-out; }
.animate-scan-warning { animation: scan-flash-warning 0.55s ease-out; }
.animate-scan-danger { animation: scan-flash-danger 0.55s ease-out; }
@keyframes pulse-badge {
0% { transform: scale(1); }
50% { transform: scale(1.12); }
100% { transform: scale(1); }
}
.animate-pulse-badge { animation: pulse-badge 0.8s infinite ease-in-out; }
.transition-all { transition: all 0.3s ease; }
</style>
{% endblock %}