diff --git a/CHANGELOG.md b/CHANGELOG.md index fb3853d..1c480e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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**: diff --git a/MEMORY.md b/MEMORY.md index c004e1b..6da9cf6 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -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. diff --git a/backend/app/__init__.py b/backend/app/__init__.py index 79cfaa5..6d04496 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -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): diff --git a/backend/setup.py b/backend/setup.py index a685a8e..ab567a5 100644 --- a/backend/setup.py +++ b/backend/setup.py @@ -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", diff --git a/frontend/package.json b/frontend/package.json index 932d266..e13e40c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "3.8.50", + "version": "3.8.51", "description": "", "main": "index.js", "scripts": { diff --git a/frontend/src/app.js b/frontend/src/app.js index 0ab3612..6f68629 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -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); diff --git a/frontend/views/reception/scanner.html b/frontend/views/reception/scanner.html index 323014f..916fc8c 100644 --- a/frontend/views/reception/scanner.html +++ b/frontend/views/reception/scanner.html @@ -102,11 +102,16 @@
-
+
Esperando lectura...
- --:-- +
+ + ¡Nuevo Escaneo! + + --:-- +
@@ -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 = ' 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 = ' 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') + ' Tiene Cursada'; + 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 = ' 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') + ' Sin Cursada Hoy'; + 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 = ' 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 = ' 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 => `
@@ -431,8 +476,16 @@ `).join(''); } else { classesContainer.innerHTML = ` -
- No tiene clases presenciales programadas para el día de hoy. +
+
+
+ +
+
+
No registra clases presenciales programadas para hoy
+
El alumno/docente ingresa a la sede pero no tiene aula asignada para la fecha actual.
+
+
`; } @@ -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; } {% endblock %}