feat(dashboard): disponibilidad por piso, métricas reales, auditoría y UI/UX v3.8.17
This commit is contained in:
@@ -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.16"
|
||||
__version__ = "3.8.17"
|
||||
|
||||
class DummyContext:
|
||||
def __enter__(self):
|
||||
|
||||
@@ -179,13 +179,35 @@ class DashboardService:
|
||||
AcademicMilestone.is_active == True
|
||||
).order_by(AcademicMilestone.date.asc()).limit(10).all()
|
||||
|
||||
recent_audits = AuditLog.query.order_by(AuditLog.created_at.desc()).limit(6).all()
|
||||
audit_data = [{
|
||||
'created_at': a.created_at.strftime('%Y-%m-%d %H:%M') if a.created_at else None,
|
||||
'action_type': getattr(a, 'action', getattr(a, 'action_type', 'AUDIT')),
|
||||
'ip_address': a.ip_address,
|
||||
'user_email': getattr(a, 'user_email', None) or (getattr(a.user, 'email', 'System') if hasattr(a, 'user') else 'System')
|
||||
} for a in recent_audits]
|
||||
recent_audits = AuditLog.query.order_by(AuditLog.created_at.desc()).limit(8).all()
|
||||
audit_data = []
|
||||
for a in recent_audits:
|
||||
d = a.to_dict()
|
||||
act_raw = (d.get('action') or '').upper()
|
||||
mod_raw = (d.get('module') or '').lower()
|
||||
action_label = {
|
||||
'LOGIN': 'Inicio de Sesión',
|
||||
'LOGOUT': 'Cierre de Sesión',
|
||||
'CREATE': 'Creación',
|
||||
'UPDATE': 'Actualización',
|
||||
'DELETE': 'Eliminación',
|
||||
'IMPERSONATE': 'Impersonación',
|
||||
'RESET': 'Reinicio de Sistema',
|
||||
'CANCEL': 'Cancelación'
|
||||
}.get(act_raw, d.get('action') or 'Operación')
|
||||
module_label = {
|
||||
'auth': 'Autenticación',
|
||||
'users': 'Usuarios',
|
||||
'classrooms': 'Aulas',
|
||||
'reservations': 'Reservas',
|
||||
'academic': 'Académica',
|
||||
'system': 'Sistema'
|
||||
}.get(mod_raw, d.get('module') or 'Sistema')
|
||||
|
||||
d['action_label'] = action_label
|
||||
d['module_label'] = module_label
|
||||
d['action_type'] = act_raw
|
||||
audit_data.append(d)
|
||||
|
||||
occupancy_rate = min(100, int((today_reservations / max(1, physical_classrooms * 3)) * 100)) if physical_classrooms > 0 else 0
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="edu-space-admin",
|
||||
version="3.8.16",
|
||||
version="3.8.17",
|
||||
description="Administrative interface for Edu-Space Classroom Management System (FastAPI ASGI Core)",
|
||||
author="Edu-Space Development Team",
|
||||
author_email="admin@edu-space.com",
|
||||
|
||||
Reference in New Issue
Block a user