feat(schedule): group reservations by real time slots and clean date-time formatting v3.4.2
This commit is contained in:
@@ -11,6 +11,19 @@ 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.
|
- **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.
|
- **Pruebas de Carga y Hardening (Fase 6):** Pruebas de estrés de concurrencia y validación final de producción.
|
||||||
|
|
||||||
|
## [3.4.2] - 2026-10-07
|
||||||
|
### Corregido & Mejorado (UX/UI)
|
||||||
|
- **Agrupación Cronológica de Reservas en Cartelera del Día (`/schedule/today_schedule`):**
|
||||||
|
- Corrección del bug que duplicaba visualmente una misma reserva por cada hora que abarcaba la cursada (eliminación del bucle `for` de franjas horarias artificiales de 1 hora).
|
||||||
|
- Implementación de agrupación nativa por franja horaria real de cursada (`grouped_slots`, ej. `08:00 - 11:00 hs`, `18:30 - 21:00 hs`).
|
||||||
|
- Cada reserva se muestra agrupada exactamente una sola vez en su bloque horario correspondiente, mostrando turno, duración, cupo, aula física/virtual, docente y enlace de videoconferencia.
|
||||||
|
- **Optimización de Formato de Fecha y Horario en el Sistema (`/schedule/list_reservations`, etc.):**
|
||||||
|
- Reemplazo del formato ISO crudo con 'T' y segundos (`2026-10-08T08:00:00 - 2026-10-08T11:00:00 hs`) por formato amigable en español:
|
||||||
|
- Fecha: `Jueves 08/10/2026` / `08/10/2026`.
|
||||||
|
- Horario: `08:00 - 11:00 hs`.
|
||||||
|
- Creación de la función utilitaria `formatReservationDates` en el BFF y nuevos filtros Nunjucks (`format_date_human`, `format_time`, `format_time_range`).
|
||||||
|
- Actualización de las vistas de tabla y mosaico/tarjetas en `list.html`, `today.html` y `view.html`.
|
||||||
|
|
||||||
## [3.4.1] - 2026-10-07
|
## [3.4.1] - 2026-10-07
|
||||||
### Corregido
|
### Corregido
|
||||||
- **Corrección de Bug en Importador de Google Sheets (`ReferenceError: availableCareers is not defined`):**
|
- **Corrección de Bug en Importador de Google Sheets (`ReferenceError: availableCareers is not defined`):**
|
||||||
|
|||||||
@@ -89,7 +89,17 @@ Memoria del proyecto entre sesiones para la rama `dev`.
|
|||||||
- Versionado elevado a `v3.4.1`.
|
- Versionado elevado a `v3.4.1`.
|
||||||
- Desplegado exitosamente en el servidor LXC `10.0.0.217` (`https://eduspace.oemspot.com.ar`).
|
- Desplegado exitosamente en el servidor LXC `10.0.0.217` (`https://eduspace.oemspot.com.ar`).
|
||||||
- Verificación HTTP 200 en `/version`, login admin, `/admin/google_sheets_import`, dashboards modularizados de los 4 roles y cuenta institucional de Bedelía.
|
- Verificación HTTP 200 en `/version`, login admin, `/admin/google_sheets_import`, dashboards modularizados de los 4 roles y cuenta institucional de Bedelía.
|
||||||
|
- **Sprint UX/UI: Agrupación Cronológica de Reservas y Formato Limpio de Fechas (v3.4.2)**:
|
||||||
|
- **Problema 1: Duplicación de Reservas por Hora en Cartelera**:
|
||||||
|
- En `/schedule/today_schedule`, un bucle fijo `for (let hour = 7; hour <= 21; hour++)` insertaba la misma reserva en cada bloque horario de 1 hora que abarcaba la materia (ej. Marketing Digital de 08:00 a 11:00 hs aparecía repetida a las 8, 9 y 10).
|
||||||
|
- **Solución**: Se eliminó la clonación artificial y se introdujo la agrupación nativa por franja horaria real de cursada (`grouped_slots`, ej. `08:00 - 11:00 hs`, `18:30 - 21:00 hs`). Cada reserva aparece agrupada exactamente UNA SOLA VEZ en su bloque horario correspondiente con turno, duración, aula, cupo y enlace a Meet/Zoom.
|
||||||
|
- **Problema 2: Formato ISO Crudo en Listado de Reservas**:
|
||||||
|
- En `/schedule/list_reservations` (tabla y tarjetas) se mostraban strings crudos con 'T' y segundos (`2026-10-08T08:00:00 - 2026-10-08T11:00:00 hs`).
|
||||||
|
- **Solución**: Se enriquecieron todas las reservas con la función `formatReservationDates` y nuevos filtros Nunjucks (`format_date_human`, `format_time`, `format_time_range`), mostrando fecha limpia (`Jueves 08/10/2026` / `08/10/2026`) y horario amigable (`08:00 - 11:00 hs`).
|
||||||
|
- **Bump Semántico y Despliegue Obligatorio (Principio 9)**:
|
||||||
|
- Versión incrementada a `v3.4.2` en Frontend y Backend.
|
||||||
|
- Despliegue inmediato al servidor institucional `10.0.0.217` y verificación en caliente.
|
||||||
|
|
||||||
## Próximos pasos
|
## Próximos pasos
|
||||||
1. Monitoreo del uso del nuevo panel modularizado de Bedelía por parte de los operadores.
|
1. Continuar con los objetivos de la Fase 6 del Roadmap institucional.
|
||||||
2. Continuar con los objetivos de la Fase 6 del Roadmap institucional.
|
2. Monitoreo continuo de la experiencia de usuario en Bedelía y Cartelera del Día.
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
## Gestión de Espacios Áulicos, Asignación de Comisiones y Operatoria de Bedelía
|
## Gestión de Espacios Áulicos, Asignación de Comisiones y Operatoria de Bedelía
|
||||||
|
|
||||||
**Institución:** Universidad de la Ciudad de Buenos Aires (UniCABA)
|
**Institución:** Universidad de la Ciudad de Buenos Aires (UniCABA)
|
||||||
**Versión:** 3.4.1 (Sprint Modularización de Vistas, Aulas Virtuales & Workflow Mandatorio)
|
**Versión:** 3.4.2 (Sprint UX/UI: Agrupación Cronológica de Reservas y Formato Limpio de Fechas)
|
||||||
**Fecha de Actualización:** 07 de Octubre de 2026
|
**Fecha de Actualización:** 07 de Octubre de 2026
|
||||||
**Rama Base:** `dev`
|
**Rama Base:** `dev`
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from flask_babel import Babel, gettext as _
|
|||||||
from config.config import Config
|
from config.config import Config
|
||||||
|
|
||||||
# Initialize extensions
|
# Initialize extensions
|
||||||
__version__ = "3.4.1"
|
__version__ = "3.4.2"
|
||||||
db = SQLAlchemy()
|
db = SQLAlchemy()
|
||||||
migrate = Migrate()
|
migrate = Migrate()
|
||||||
cors = CORS()
|
cors = CORS()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ OPENAPI_SPEC = {
|
|||||||
"info": {
|
"info": {
|
||||||
"title": "Edu-Space REST API",
|
"title": "Edu-Space REST API",
|
||||||
"description": "Enterprise Academic & Physical Space Management REST API with JWT Authentication and Role-Based Access Control.",
|
"description": "Enterprise Academic & Physical Space Management REST API with JWT Authentication and Role-Based Access Control.",
|
||||||
"version": "3.4.1"
|
"version": "3.4.2"
|
||||||
},
|
},
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="edu-space-admin",
|
name="edu-space-admin",
|
||||||
version="3.4.1",
|
version="3.4.2",
|
||||||
description="Administrative interface for Edu-Space Classroom Management System",
|
description="Administrative interface for Edu-Space Classroom Management System",
|
||||||
author="Edu-Space Development Team",
|
author="Edu-Space Development Team",
|
||||||
author_email="admin@edu-space.com",
|
author_email="admin@edu-space.com",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "3.4.1",
|
"version": "3.4.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+60
-7
@@ -85,9 +85,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Versiones institucionales del sistema
|
// Versiones institucionales del sistema
|
||||||
const APP_VERSION = '3.4.1';
|
const APP_VERSION = '3.4.2';
|
||||||
const FRONTEND_VERSION = '3.4.1';
|
const FRONTEND_VERSION = '3.4.2';
|
||||||
const BACKEND_VERSION = '3.4.1';
|
const BACKEND_VERSION = '3.4.2';
|
||||||
|
|
||||||
env.addGlobal('app_version', APP_VERSION);
|
env.addGlobal('app_version', APP_VERSION);
|
||||||
env.addGlobal('frontend_version', FRONTEND_VERSION);
|
env.addGlobal('frontend_version', FRONTEND_VERSION);
|
||||||
@@ -129,20 +129,73 @@ env.addFilter('format', function(str, ...args) {
|
|||||||
|
|
||||||
const formatDateHelper = function(d, fmt) {
|
const formatDateHelper = function(d, fmt) {
|
||||||
if (!d) return '';
|
if (!d) return '';
|
||||||
if (typeof d === 'string') return d.split('T')[0];
|
let str = String(d);
|
||||||
return new Date(d).toISOString().split('T')[0];
|
let datePart = str.includes('T') ? str.split('T')[0] : (str.includes(' ') ? str.split(' ')[0] : str);
|
||||||
|
if (datePart.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
||||||
|
const [y, m, day] = datePart.split('-');
|
||||||
|
const year = parseInt(y, 10);
|
||||||
|
const month = parseInt(m, 10);
|
||||||
|
const dayNum = parseInt(day, 10);
|
||||||
|
const dObj = new Date(year, month - 1, dayNum);
|
||||||
|
const daysNames = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'];
|
||||||
|
const monthsNames = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
|
||||||
|
const dayName = daysNames[dObj.getDay()] || '';
|
||||||
|
const monthName = monthsNames[month - 1] || '';
|
||||||
|
const dayPad = String(dayNum).padStart(2, '0');
|
||||||
|
const monthPad = String(month).padStart(2, '0');
|
||||||
|
|
||||||
|
if (fmt === 'long' || fmt === 'human') {
|
||||||
|
return `${dayName} ${dayPad}/${monthPad}/${year}`;
|
||||||
|
}
|
||||||
|
if (fmt === 'full') {
|
||||||
|
return `${dayName}, ${dayPad} de ${monthName} de ${year}`;
|
||||||
|
}
|
||||||
|
return `${dayPad}/${monthPad}/${year}`;
|
||||||
|
}
|
||||||
|
return datePart;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDateTimeHelper = function(d, fmt) {
|
const formatDateTimeHelper = function(d, fmt) {
|
||||||
if (!d) return '';
|
if (!d) return '';
|
||||||
if (typeof d === 'string') return d.replace('T', ' ').substring(0, 16);
|
let str = String(d);
|
||||||
return new Date(d).toLocaleString();
|
let datePart = formatDateHelper(str);
|
||||||
|
let timePart = '';
|
||||||
|
if (str.includes('T')) {
|
||||||
|
timePart = str.split('T')[1].substring(0, 5) + ' hs';
|
||||||
|
} else if (str.includes(' ')) {
|
||||||
|
timePart = str.split(' ')[1].substring(0, 5) + ' hs';
|
||||||
|
}
|
||||||
|
return timePart ? `${datePart} ${timePart}` : datePart;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatTimeCleanHelper = function(d) {
|
||||||
|
if (!d) return '';
|
||||||
|
let str = String(d);
|
||||||
|
if (str.includes('T')) return str.split('T')[1].substring(0, 5) + ' hs';
|
||||||
|
if (str.includes(' ')) return str.split(' ')[1].substring(0, 5) + ' hs';
|
||||||
|
if (str.match(/^\d{2}:\d{2}/)) return str.substring(0, 5) + ' hs';
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatTimeRangeHelper = function(start, end) {
|
||||||
|
if (!start) return '';
|
||||||
|
let s = String(start);
|
||||||
|
let e = String(end || '');
|
||||||
|
let st = s.includes('T') ? s.split('T')[1].substring(0, 5) : (s.includes(' ') ? s.split(' ')[1].substring(0, 5) : s.substring(0, 5));
|
||||||
|
let et = e.includes('T') ? e.split('T')[1].substring(0, 5) : (e.includes(' ') ? e.split(' ')[1].substring(0, 5) : e.substring(0, 5));
|
||||||
|
return et ? `${st} - ${et} hs` : `${st} hs`;
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addGlobal('format_date', formatDateHelper);
|
env.addGlobal('format_date', formatDateHelper);
|
||||||
env.addGlobal('format_datetime', formatDateTimeHelper);
|
env.addGlobal('format_datetime', formatDateTimeHelper);
|
||||||
|
env.addGlobal('format_time', formatTimeCleanHelper);
|
||||||
|
env.addGlobal('format_time_range', formatTimeRangeHelper);
|
||||||
|
|
||||||
env.addFilter('format_date', formatDateHelper);
|
env.addFilter('format_date', formatDateHelper);
|
||||||
env.addFilter('format_datetime', formatDateTimeHelper);
|
env.addFilter('format_datetime', formatDateTimeHelper);
|
||||||
|
env.addFilter('format_date_human', function(d) { return formatDateHelper(d, 'human'); });
|
||||||
|
env.addFilter('format_time', formatTimeCleanHelper);
|
||||||
|
env.addFilter('format_time_range', formatTimeRangeHelper);
|
||||||
|
|
||||||
env.addFilter('tojson', function(val) {
|
env.addFilter('tojson', function(val) {
|
||||||
return JSON.stringify(val !== undefined ? val : null);
|
return JSON.stringify(val !== undefined ? val : null);
|
||||||
|
|||||||
+159
-23
@@ -125,11 +125,132 @@ const handleCalendarData = async (req, res) => {
|
|||||||
router.get('/calendar_data', handleCalendarData);
|
router.get('/calendar_data', handleCalendarData);
|
||||||
router.get('/calendar-data', handleCalendarData);
|
router.get('/calendar-data', handleCalendarData);
|
||||||
|
|
||||||
|
// Función utilitaria para normalizar y formatear fechas, horarios y atributos de una reserva
|
||||||
|
function formatReservationDates(r) {
|
||||||
|
if (!r) return r;
|
||||||
|
const rawStart = r.start_time ? String(r.start_time) : '';
|
||||||
|
const rawEnd = r.end_time ? String(r.end_time) : '';
|
||||||
|
|
||||||
|
// Extraer fecha 'YYYY-MM-DD'
|
||||||
|
let dateStr = '';
|
||||||
|
if (rawStart.includes('T')) {
|
||||||
|
dateStr = rawStart.split('T')[0];
|
||||||
|
} else if (rawStart.includes(' ')) {
|
||||||
|
dateStr = rawStart.split(' ')[0];
|
||||||
|
} else if (rawStart.match(/^\d{4}-\d{2}-\d{2}/)) {
|
||||||
|
dateStr = rawStart.substring(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extraer horas HH:mm
|
||||||
|
let startTimeStr = '08:00';
|
||||||
|
let endTimeStr = '10:00';
|
||||||
|
if (rawStart.includes('T')) {
|
||||||
|
startTimeStr = rawStart.split('T')[1].substring(0, 5);
|
||||||
|
} else if (rawStart.includes(' ')) {
|
||||||
|
startTimeStr = rawStart.split(' ')[1].substring(0, 5);
|
||||||
|
} else if (rawStart.match(/^\d{2}:\d{2}/)) {
|
||||||
|
startTimeStr = rawStart.substring(0, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawEnd.includes('T')) {
|
||||||
|
endTimeStr = rawEnd.split('T')[1].substring(0, 5);
|
||||||
|
} else if (rawEnd.includes(' ')) {
|
||||||
|
endTimeStr = rawEnd.split(' ')[1].substring(0, 5);
|
||||||
|
} else if (rawEnd.match(/^\d{2}:\d{2}/)) {
|
||||||
|
endTimeStr = rawEnd.substring(0, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formatear fecha en español
|
||||||
|
let date_short = dateStr;
|
||||||
|
let date_display = dateStr;
|
||||||
|
let date_full = dateStr;
|
||||||
|
if (dateStr && dateStr.includes('-')) {
|
||||||
|
const parts = dateStr.split('-');
|
||||||
|
if (parts.length === 3) {
|
||||||
|
const year = parseInt(parts[0], 10);
|
||||||
|
const month = parseInt(parts[1], 10);
|
||||||
|
const day = parseInt(parts[2], 10);
|
||||||
|
const dObj = new Date(year, month - 1, day);
|
||||||
|
const daysNames = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'];
|
||||||
|
const monthsNames = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
|
||||||
|
const dayName = daysNames[dObj.getDay()] || '';
|
||||||
|
const monthName = monthsNames[month - 1] || '';
|
||||||
|
const dayPad = String(day).padStart(2, '0');
|
||||||
|
const monthPad = String(month).padStart(2, '0');
|
||||||
|
|
||||||
|
date_short = `${dayPad}/${monthPad}/${year}`;
|
||||||
|
date_display = `${dayName} ${dayPad}/${monthPad}/${year}`;
|
||||||
|
date_full = `${dayName}, ${dayPad} de ${monthName} de ${year}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calcular duración amigable
|
||||||
|
let durationMinutes = 0;
|
||||||
|
if (startTimeStr && endTimeStr) {
|
||||||
|
const [sh, sm] = startTimeStr.split(':').map(Number);
|
||||||
|
const [eh, em] = endTimeStr.split(':').map(Number);
|
||||||
|
durationMinutes = (eh * 60 + em) - (sh * 60 + sm);
|
||||||
|
if (durationMinutes < 0) durationMinutes += 24 * 60;
|
||||||
|
}
|
||||||
|
let duration_display = '2 hs';
|
||||||
|
if (durationMinutes > 0) {
|
||||||
|
const hours = Math.floor(durationMinutes / 60);
|
||||||
|
const mins = durationMinutes % 60;
|
||||||
|
if (mins === 0) {
|
||||||
|
duration_display = `${hours} hs`;
|
||||||
|
} else {
|
||||||
|
duration_display = `${hours}h ${mins}m`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const isVirt = Boolean(r.is_virtual || (r.classroom && r.classroom.is_virtual) || (r.classroom_name && r.classroom_name.includes('VIRTUAL')));
|
||||||
|
const startHour = parseInt(startTimeStr.split(':')[0], 10) || 8;
|
||||||
|
let inferredShift = r.shift;
|
||||||
|
if (!inferredShift) {
|
||||||
|
if (startHour >= 18) inferredShift = 'Noche';
|
||||||
|
else if (startHour >= 13) inferredShift = 'Tarde';
|
||||||
|
else inferredShift = 'Mañana';
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...r,
|
||||||
|
raw_start_time: rawStart,
|
||||||
|
raw_end_time: rawEnd,
|
||||||
|
start_time: startTimeStr,
|
||||||
|
end_time: endTimeStr,
|
||||||
|
start_time_clean: startTimeStr,
|
||||||
|
end_time_clean: endTimeStr,
|
||||||
|
start_time_display: `${startTimeStr} hs`,
|
||||||
|
end_time_display: `${endTimeStr} hs`,
|
||||||
|
time_display: `${startTimeStr} - ${endTimeStr} hs`,
|
||||||
|
time_range: `${startTimeStr} - ${endTimeStr} hs`,
|
||||||
|
duration_minutes: durationMinutes,
|
||||||
|
duration_display,
|
||||||
|
date_raw: dateStr,
|
||||||
|
date_short,
|
||||||
|
date_display,
|
||||||
|
date_full,
|
||||||
|
shift: inferredShift,
|
||||||
|
is_virtual: isVirt,
|
||||||
|
subject_name: r.subject_name || r.purpose || 'Clase Regular',
|
||||||
|
subject_code: r.subject_code || '',
|
||||||
|
effective_virtual_link: r.effective_virtual_link || r.virtual_link || '',
|
||||||
|
classroom: r.classroom || {
|
||||||
|
code: r.classroom_name || (isVirt ? 'VIRTUAL' : 'Sin Aula'),
|
||||||
|
floor: isVirt ? 0 : 1,
|
||||||
|
is_virtual: isVirt,
|
||||||
|
building: isVirt ? 'Campus Virtual' : 'Edificio Central'
|
||||||
|
},
|
||||||
|
user: r.user || { name: r.teacher_name || 'Docente' }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// 3. Vista de Lista de Reservas
|
// 3. Vista de Lista de Reservas
|
||||||
const handleReservationsList = async (req, res) => {
|
const handleReservationsList = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const response = await req.apiClient.get('/reservations');
|
const response = await req.apiClient.get('/reservations');
|
||||||
const reservations = (response.data && response.data.reservations) || [];
|
const rawReservations = (response.data && response.data.reservations) || [];
|
||||||
|
const reservations = rawReservations.map(formatReservationDates);
|
||||||
|
|
||||||
res.render('schedule/list', {
|
res.render('schedule/list', {
|
||||||
title: 'Listado de Reservas - Edu-Space Admin',
|
title: 'Listado de Reservas - Edu-Space Admin',
|
||||||
@@ -190,35 +311,46 @@ const handleTodaySchedule = async (req, res) => {
|
|||||||
const response = await req.apiClient.get('/reservations', { params });
|
const response = await req.apiClient.get('/reservations', { params });
|
||||||
let rawReservations = (response.data && response.data.reservations) || [];
|
let rawReservations = (response.data && response.data.reservations) || [];
|
||||||
|
|
||||||
// Format each reservation for the template
|
// Formatear cada reserva con atributos enriquecidos
|
||||||
const reservations = rawReservations.map(r => {
|
const reservations = rawReservations.map(formatReservationDates);
|
||||||
const st = r.start_time.includes('T') ? r.start_time.split('T')[1].substring(0, 5) : r.start_time;
|
|
||||||
const et = r.end_time.includes('T') ? r.end_time.split('T')[1].substring(0, 5) : r.end_time;
|
// Agrupar en franjas horarias reales (Time Slots) para que cada reserva aparezca agrupada y una sola vez
|
||||||
const isVirt = Boolean(r.is_virtual || (r.classroom && r.classroom.is_virtual));
|
const slotsMap = new Map();
|
||||||
return {
|
reservations.forEach(r => {
|
||||||
...r,
|
const slotKey = `${r.start_time} - ${r.end_time}`;
|
||||||
start_time: st,
|
if (!slotsMap.has(slotKey)) {
|
||||||
end_time: et,
|
slotsMap.set(slotKey, {
|
||||||
subject_name: r.subject_name || r.purpose || 'Clase Regular',
|
key: slotKey,
|
||||||
subject_code: r.subject_code || '',
|
start_time: r.start_time,
|
||||||
effective_virtual_link: r.effective_virtual_link || r.virtual_link || '',
|
end_time: r.end_time,
|
||||||
is_virtual: isVirt,
|
time_display: r.time_display,
|
||||||
classroom: r.classroom || { code: r.classroom_name || (isVirt ? 'VIRTUAL' : 'Sin Aula'), floor: isVirt ? 0 : 1, is_virtual: isVirt },
|
duration_display: r.duration_display,
|
||||||
user: r.user || { name: r.teacher_name || 'Docente' }
|
shift: r.shift,
|
||||||
};
|
items: []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
slotsMap.get(slotKey).items.push({
|
||||||
|
reservation: r,
|
||||||
|
classroom: r.classroom,
|
||||||
|
commission: r.commission,
|
||||||
|
user: r.user
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build time_blocks for hours 7 to 21
|
// Ordenar slots cronológicamente por horario de inicio y fin
|
||||||
|
const grouped_slots = Array.from(slotsMap.values()).sort((a, b) => {
|
||||||
|
return a.start_time.localeCompare(b.start_time) || a.end_time.localeCompare(b.end_time);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mantener time_blocks por compatibilidad (asigna a la hora de inicio sin duplicar)
|
||||||
const time_blocks = {};
|
const time_blocks = {};
|
||||||
for (let hour = 7; hour <= 21; hour++) {
|
for (let hour = 7; hour <= 21; hour++) {
|
||||||
time_blocks[hour] = [];
|
time_blocks[hour] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
reservations.forEach(r => {
|
reservations.forEach(r => {
|
||||||
const startHour = parseInt(r.start_time.split(':')[0], 10) || 8;
|
const startHour = parseInt(r.start_time.split(':')[0], 10) || 8;
|
||||||
const endHour = parseInt(r.end_time.split(':')[0], 10) || (startHour + 2);
|
if (time_blocks[startHour]) {
|
||||||
for (let h = Math.max(7, startHour); h <= Math.min(21, endHour - 1); h++) {
|
time_blocks[startHour].push({
|
||||||
time_blocks[h].push({
|
|
||||||
reservation: r,
|
reservation: r,
|
||||||
classroom: r.classroom,
|
classroom: r.classroom,
|
||||||
commission: r.commission,
|
commission: r.commission,
|
||||||
@@ -227,7 +359,7 @@ const handleTodaySchedule = async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Compute stats
|
// Computar estadísticas
|
||||||
const confirmed = reservations.filter(r => r.status === 'CONFIRMED').length;
|
const confirmed = reservations.filter(r => r.status === 'CONFIRMED').length;
|
||||||
const pending = reservations.filter(r => r.status === 'PENDING').length;
|
const pending = reservations.filter(r => r.status === 'PENDING').length;
|
||||||
const occupied_classrooms = new Set(reservations.map(r => r.classroom_id).filter(Boolean)).size;
|
const occupied_classrooms = new Set(reservations.map(r => r.classroom_id).filter(Boolean)).size;
|
||||||
@@ -245,6 +377,7 @@ const handleTodaySchedule = async (req, res) => {
|
|||||||
res.render('schedule/today', {
|
res.render('schedule/today', {
|
||||||
title: 'Cartelera del Día - Edu-Space Admin',
|
title: 'Cartelera del Día - Edu-Space Admin',
|
||||||
reservations,
|
reservations,
|
||||||
|
grouped_slots,
|
||||||
time_blocks,
|
time_blocks,
|
||||||
stats,
|
stats,
|
||||||
today: todayStr,
|
today: todayStr,
|
||||||
@@ -263,6 +396,7 @@ const handleTodaySchedule = async (req, res) => {
|
|||||||
res.render('schedule/today', {
|
res.render('schedule/today', {
|
||||||
title: 'Cartelera del Día (Offline)',
|
title: 'Cartelera del Día (Offline)',
|
||||||
reservations: [],
|
reservations: [],
|
||||||
|
grouped_slots: [],
|
||||||
time_blocks: {},
|
time_blocks: {},
|
||||||
stats: { total_reservations: 0, confirmed: 0, pending: 0, occupied_classrooms: 0, total_classrooms: 59 },
|
stats: { total_reservations: 0, confirmed: 0, pending: 0, occupied_classrooms: 0, total_classrooms: 59 },
|
||||||
today: fallbackToday,
|
today: fallbackToday,
|
||||||
@@ -461,9 +595,11 @@ const handleViewReservation = async (req, res) => {
|
|||||||
|
|
||||||
const response = await req.apiClient.get(`/reservations/${id}`);
|
const response = await req.apiClient.get(`/reservations/${id}`);
|
||||||
const r = response.data;
|
const r = response.data;
|
||||||
|
const formatted = formatReservationDates(r);
|
||||||
|
|
||||||
const resObj = {
|
const resObj = {
|
||||||
...r,
|
...r,
|
||||||
|
...formatted,
|
||||||
status: {
|
status: {
|
||||||
value: (r.status || 'CONFIRMED').toUpperCase(),
|
value: (r.status || 'CONFIRMED').toUpperCase(),
|
||||||
toString: () => (r.status || 'CONFIRMED').toUpperCase()
|
toString: () => (r.status || 'CONFIRMED').toUpperCase()
|
||||||
|
|||||||
@@ -173,8 +173,12 @@
|
|||||||
{% for reservation in reservations.items %}
|
{% for reservation in reservations.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="ps-3">
|
<td class="ps-3">
|
||||||
<div class="fw-bold">{{ reservation.start_time }}</div>
|
<div class="fw-bold text-dark text-nowrap">
|
||||||
<small class="text-muted font-monospace">{{ reservation.start_time }} - {{ reservation.end_time }} hs</small>
|
<i class="bi bi-calendar-event me-1 text-primary"></i>{{ reservation.date_display or reservation.date_short or format_date_human(reservation.start_time) }}
|
||||||
|
</div>
|
||||||
|
<span class="badge bg-light text-dark border font-monospace mt-1">
|
||||||
|
<i class="bi bi-clock me-1 text-primary"></i>{{ reservation.time_display or (reservation.start_time ~ ' - ' ~ reservation.end_time ~ ' hs') }}
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge bg-secondary-subtle text-secondary border font-monospace">
|
<span class="badge bg-secondary-subtle text-secondary border font-monospace">
|
||||||
@@ -258,10 +262,10 @@
|
|||||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||||
<div>
|
<div>
|
||||||
<span class="badge bg-primary text-white font-monospace mb-1">
|
<span class="badge bg-primary text-white font-monospace mb-1">
|
||||||
<i class="bi bi-calendar-event me-1"></i>{{ reservation.start_time }}
|
<i class="bi bi-calendar-event me-1"></i>{{ reservation.date_display or reservation.date_short or format_date_human(reservation.start_time) }}
|
||||||
</span>
|
</span>
|
||||||
<div class="small fw-bold text-muted font-monospace">
|
<div class="small fw-bold text-muted font-monospace">
|
||||||
<i class="bi bi-clock me-1"></i>{{ reservation.start_time }} - {{ reservation.end_time }} hs
|
<i class="bi bi-clock me-1 text-primary"></i>{{ reservation.time_display or (reservation.start_time ~ ' - ' ~ reservation.end_time ~ ' hs') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if reservation.status == 'CONFIRMED' or reservation.status.value == 'CONFIRMED' %}
|
{% if reservation.status == 'CONFIRMED' or reservation.status.value == 'CONFIRMED' %}
|
||||||
|
|||||||
@@ -179,25 +179,35 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="card-body p-3">
|
<div class="card-body p-3">
|
||||||
<!-- Timeline View -->
|
<!-- Timeline View: Agrupado por franja horaria real sin repeticiones -->
|
||||||
<div id="timeline-view">
|
<div id="timeline-view">
|
||||||
{% for hour in range(7, 22) %}
|
{% for slot in grouped_slots %}
|
||||||
<div class="row border-bottom py-3 align-items-start {% if time_blocks[hour] %}bg-light-subtle{% endif %}">
|
<div class="row border-bottom py-3 align-items-stretch bg-light-subtle mb-3 rounded border mx-0">
|
||||||
<div class="col-md-2 col-3">
|
<div class="col-lg-2 col-md-3 col-12 mb-3 mb-md-0 d-flex flex-column justify-content-center">
|
||||||
<div class="text-center p-2 rounded bg-body-tertiary border">
|
<div class="text-center p-3 rounded bg-body-tertiary border shadow-sm h-100 d-flex flex-column justify-content-center">
|
||||||
<strong class="h5 text-primary mb-0 font-monospace">{% if hour < 10 %}0{% endif %}{{ hour }}:00</strong>
|
<div class="badge bg-primary-subtle text-primary border border-primary-subtle mb-2 font-monospace">
|
||||||
<div class="small text-muted font-monospace">{{ hour+1 }}:00 hs</div>
|
<i class="bi bi-clock me-1"></i>{{ slot.shift }}
|
||||||
|
</div>
|
||||||
|
<strong class="h4 text-primary d-block mb-0 font-monospace">{{ slot.start_time }}</strong>
|
||||||
|
<div class="small fw-bold text-dark font-monospace">a {{ slot.end_time }} hs</div>
|
||||||
|
<div class="badge bg-secondary-subtle text-secondary border mt-2 align-self-center font-monospace" style="font-size: 0.75rem;">
|
||||||
|
<i class="bi bi-hourglass-split me-1"></i>{{ slot.duration_display }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<span class="badge bg-light text-muted border" style="font-size: 0.72rem;">
|
||||||
|
{{ slot.items | length }} {% if slot.items | length == 1 %}asignatura{% else %}asignaturas{% endif %}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10 col-9">
|
</div>
|
||||||
{% if time_blocks[hour] %}
|
<div class="col-lg-10 col-md-9 col-12">
|
||||||
<div class="row g-2">
|
<div class="row g-2">
|
||||||
{% for item in time_blocks[hour] %}
|
{% for item in slot.items %}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6 col-xl-6">
|
||||||
<div class="card border-0 shadow-sm h-100 border-start border-4 border-primary">
|
<div class="card border-0 shadow-sm h-100 border-start border-4 {% if item.reservation.is_virtual %}border-info{% else %}border-primary{% endif %}">
|
||||||
<div class="card-body p-3">
|
<div class="card-body p-3 d-flex flex-column justify-content-between">
|
||||||
|
<div>
|
||||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||||
<div>
|
<div>
|
||||||
<h6 class="card-title fw-bold mb-1 text-primary">
|
<h6 class="card-title fw-bold mb-1 text-primary">
|
||||||
@@ -207,33 +217,47 @@
|
|||||||
{{ item.reservation.subject_code }}
|
{{ item.reservation.subject_code }}
|
||||||
</span>
|
</span>
|
||||||
<span class="badge bg-info-subtle text-info border">
|
<span class="badge bg-info-subtle text-info border">
|
||||||
{{ item.reservation.shift or 'Tarde' }}
|
{{ item.reservation.shift or slot.shift }}
|
||||||
</span>
|
</span>
|
||||||
|
{% if item.reservation.commission %}
|
||||||
|
<span class="badge bg-light text-dark border font-monospace">
|
||||||
|
{{ item.reservation.commission.code or item.reservation.commission.name }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<span class="badge bg-{% if item.reservation.status == 'CONFIRMED' or item.reservation.status.value == 'CONFIRMED' %}success-subtle text-success border border-success-subtle{% else %}warning-subtle text-warning border border-warning-subtle{% endif %}">
|
<span class="badge bg-{% if item.reservation.status == 'CONFIRMED' or item.reservation.status.value == 'CONFIRMED' %}success-subtle text-success border border-success-subtle{% else %}warning-subtle text-warning border border-warning-subtle{% endif %}">
|
||||||
{% if item.reservation.status == 'CONFIRMED' or item.reservation.status.value == 'CONFIRMED' %}
|
{% if item.reservation.status == 'CONFIRMED' or item.reservation.status.value == 'CONFIRMED' %}
|
||||||
Confirmada
|
<i class="bi bi-check-circle me-1"></i>Confirmada
|
||||||
{% else %}
|
{% else %}
|
||||||
Pendiente
|
<i class="bi bi-clock me-1"></i>Pendiente
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small text-muted mb-2">
|
<div class="small text-muted mb-2">
|
||||||
<span class="fw-semibold text-dark me-2">
|
<span class="fw-semibold text-dark me-2">
|
||||||
|
{% if item.reservation.is_virtual %}
|
||||||
|
<i class="bi bi-laptop me-1 text-info"></i>{{ item.classroom.code }}
|
||||||
|
{% else %}
|
||||||
<i class="bi bi-door-open me-1 text-success"></i>{{ item.classroom.code }}
|
<i class="bi bi-door-open me-1 text-success"></i>{{ item.classroom.code }}
|
||||||
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
<span class="me-2">
|
<span class="me-2">
|
||||||
<i class="bi bi-layers me-1"></i>{% if item.classroom.floor == 0 %}PB{% else %}Piso {{ item.classroom.floor }}{% endif %}
|
<i class="bi bi-layers me-1"></i>{% if item.classroom.floor == 0 %}PB{% else %}Piso {{ item.classroom.floor }}{% endif %}
|
||||||
|
{% if item.classroom.building %} · {{ item.classroom.building }}{% endif %}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<i class="bi bi-clock me-1 text-warning"></i>{{ item.reservation.start_time }} - {{ item.reservation.end_time }} hs
|
<i class="bi bi-clock me-1 text-warning"></i>{{ item.reservation.time_display }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-items-center pt-2 border-top">
|
<div class="d-flex justify-content-between align-items-center pt-2 border-top mt-2">
|
||||||
<span class="small text-muted">
|
<span class="small text-muted">
|
||||||
<i class="bi bi-people me-1"></i>{{ item.reservation.expected_attendees }} estudiantes
|
<i class="bi bi-people me-1"></i>{{ item.reservation.expected_attendees }} estudiantes
|
||||||
|
{% if item.reservation.teacher_name or item.user.name %}
|
||||||
|
· <i class="bi bi-person me-1"></i>{{ item.reservation.teacher_name or item.user.name }}
|
||||||
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
<div class="d-flex gap-1">
|
<div class="d-flex gap-1">
|
||||||
{% if item.reservation.effective_virtual_link %}
|
{% if item.reservation.effective_virtual_link %}
|
||||||
@@ -256,12 +280,12 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="text-muted py-2 small ps-2">
|
<div class="text-center py-4 text-muted">
|
||||||
<i class="bi bi-dash-circle me-1"></i>Sin clases programadas en este horario
|
<i class="bi bi-calendar-check fs-2 d-block mb-2"></i>
|
||||||
</div>
|
No hay clases programadas para esta fecha con los filtros aplicados.
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
@@ -284,15 +308,16 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for reservation in reservations %}
|
{% for reservation in reservations %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="ps-3 font-monospace fw-bold">
|
<td class="ps-3 font-monospace fw-bold text-nowrap">
|
||||||
{{ reservation.start_time }} - {{ reservation.end_time }} hs
|
<i class="bi bi-clock me-1 text-primary"></i>{{ reservation.time_display }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge bg-secondary-subtle text-secondary font-monospace border">
|
<span class="badge bg-secondary-subtle text-secondary font-monospace border">
|
||||||
{{ reservation.classroom.code if reservation.classroom else 'Sin Aula' }}
|
{{ reservation.classroom.code if reservation.classroom else 'Sin Aula' }}
|
||||||
</span>
|
</span>
|
||||||
<small class="text-muted d-block">
|
<small class="text-muted d-block">
|
||||||
{% if reservation.classroom and reservation.classroom.floor == 0 %}Planta Baja{% elif reservation.classroom %}Piso {{ reservation.classroom.floor }}{% endif %}
|
{% if reservation.classroom and reservation.classroom.floor == 0 %}PB{% elif reservation.classroom %}Piso {{ reservation.classroom.floor }}{% endif %}
|
||||||
|
{% if reservation.classroom and reservation.classroom.building %} · {{ reservation.classroom.building }}{% endif %}
|
||||||
</small>
|
</small>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -56,11 +56,11 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-3">
|
<div class="col-md-6 mb-3">
|
||||||
<label class="text-muted small">Date & Time</label>
|
<label class="text-muted small">Fecha y Horario</label>
|
||||||
<p class="mb-0">
|
<p class="mb-0">
|
||||||
<i class="bi bi-clock"></i>
|
<i class="bi bi-clock me-1 text-primary"></i>
|
||||||
{{ format_date(reservation.start_time, format='long')|capitalize }}<br>
|
<span class="fw-bold">{{ reservation.date_display or format_date(reservation.start_time, 'human') }}</span><br>
|
||||||
{{ reservation.start_time }} - {{ reservation.end_time }}
|
<span class="font-monospace text-muted">{{ reservation.time_display or (reservation.start_time ~ ' - ' ~ reservation.end_time ~ ' hs') }}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-3">
|
<div class="col-md-6 mb-3">
|
||||||
|
|||||||
Reference in New Issue
Block a user