diff --git a/app/routers/admin.py b/app/routers/admin.py index 4ff71b8..0190d0f 100644 --- a/app/routers/admin.py +++ b/app/routers/admin.py @@ -244,6 +244,7 @@ def voting_admin(request: Request, db: Session = Depends(get_db)): "config": config, "results": results, "total_votes": total_votes, + "server_time": datetime.now().strftime("%H:%M:%S"), "error": None, "success": None, }, @@ -261,6 +262,8 @@ def update_voting_config( _require_admin(request) config = _get_or_create_config(db) + now_str = datetime.now().strftime("%H:%M:%S") + try: datetime.strptime(start_time, "%H:%M") datetime.strptime(end_time, "%H:%M") @@ -273,6 +276,7 @@ def update_voting_config( "config": config, "results": results, "total_votes": sum(r["votes"] for r in results), + "server_time": now_str, "error": "Formato de hora inválido. Use HH:MM", "success": None, }, @@ -288,6 +292,7 @@ def update_voting_config( "config": config, "results": results, "total_votes": sum(r["votes"] for r in results), + "server_time": now_str, "error": "La hora de inicio debe ser anterior a la hora de fin", "success": None, }, @@ -307,6 +312,7 @@ def update_voting_config( "config": config, "results": results, "total_votes": sum(r["votes"] for r in results), + "server_time": now_str, "error": None, "success": "Configuración guardada", }, diff --git a/app/templates/admin/voting.html b/app/templates/admin/voting.html index 864c54a..ff10838 100644 --- a/app/templates/admin/voting.html +++ b/app/templates/admin/voting.html @@ -54,12 +54,15 @@ -
- {% if config.is_active %} - 🟢 Activa · Ventana: {{ config.start_time }} – {{ config.end_time }} - {% else %} - 🔴 Inactiva - {% endif %} +
+
+ {% if config.is_active %} + 🟢 Activa · Ventana: {{ config.start_time }} – {{ config.end_time }} + {% else %} + 🔴 Inactiva + {% endif %} +
+
🕐 Hora del servidor: {{ server_time }}
@@ -140,6 +143,8 @@ } .status-active { background: rgba(29,185,84,.15); color: var(--green); border: 1px solid rgba(29,185,84,.3); } .status-inactive { background: rgba(136,136,136,.1); color: var(--text-muted); border: 1px solid #333; } +.status-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; } +.server-time { font-size: .8rem; color: var(--text-muted); } .results-header { display: flex; justify-content: space-between; align-items: center; } .results-list { display: flex; flex-direction: column; gap: .5rem; margin-top: .25rem; } diff --git a/docker-compose.yml b/docker-compose.yml index b23ee48..4c5836f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: ports: - "8000:8000" env_file: .env + environment: + TZ: America/Santiago volumes: - ./data:/app/data restart: unless-stopped