corrige zona horaria en votación: TZ=America/Santiago en contenedor

El contenedor corría en UTC causando que la ventana horaria no
coincidiera con la hora local. Se agrega TZ en docker-compose y se
muestra la hora actual del servidor en el panel de votación.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-23 18:16:39 -04:00
parent 2abe7b47fd
commit 36a40938c7
3 changed files with 19 additions and 6 deletions
+6
View File
@@ -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",
},
+5
View File
@@ -54,6 +54,7 @@
<button type="submit" class="btn-primary">Guardar configuración</button>
</form>
<div class="status-row">
<div class="status-badge {% if config.is_active %}status-active{% else %}status-inactive{% endif %}">
{% if config.is_active %}
🟢 Activa · Ventana: {{ config.start_time }} {{ config.end_time }}
@@ -61,6 +62,8 @@
🔴 Inactiva
{% endif %}
</div>
<div class="server-time">🕐 Hora del servidor: <strong>{{ server_time }}</strong></div>
</div>
</div>
<!-- Resultados -->
@@ -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; }
+2
View File
@@ -4,6 +4,8 @@ services:
ports:
- "8000:8000"
env_file: .env
environment:
TZ: America/Santiago
volumes:
- ./data:/app/data
restart: unless-stopped