fix(qa): resolver diagnosticos estaticos, sincronizacion moodle y actualizar docs v3.6.4

This commit is contained in:
2026-10-19 14:05:58 -03:00
parent 9ad70d69e9
commit 6057b6d206
47 changed files with 372 additions and 232 deletions
+13 -12
View File
@@ -1,7 +1,7 @@
import time
import uuid
import threading
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from enum import Enum
from typing import List, Dict, Any, Optional
from flask import current_app
@@ -39,7 +39,7 @@ class OptimizerJob:
self.reservations: List[Dict[str, Any]] = []
self.conflicts: List[Dict[str, Any]] = []
self.error: Optional[str] = None
self.created_at = datetime.utcnow()
self.created_at = datetime.now(timezone.utc).replace(tzinfo=None)
self.started_at: Optional[datetime] = None
self.completed_at: Optional[datetime] = None
self.execution_time_ms: Optional[float] = None
@@ -109,7 +109,7 @@ class OptimizerService:
# Si no se pasó app explícitamente, intentar obtener current_app
if app is None:
try:
app = current_app._get_current_object()
app = getattr(current_app, '_get_current_object', lambda: current_app)()
except Exception:
app = None
@@ -133,14 +133,15 @@ class OptimizerService:
t_start = time.perf_counter()
with cls._lock:
job.status = OptimizerJobStatus.RUNNING
job.started_at = datetime.utcnow()
job.started_at = datetime.now(timezone.utc).replace(tzinfo=None)
def progress_callback(gen: int, total_gen: int, pct: int, best_fit: float):
with cls._lock:
job.generation = gen
job.total_generations = total_gen
job.progress = pct
job.fitness_score = best_fit
if job:
with cls._lock:
job.generation = gen
job.total_generations = total_gen
job.progress = pct
job.fitness_score = best_fit
optimizer = ReservationOptimizer(
population_size=job.params.get("population_size", 40),
@@ -167,7 +168,7 @@ class OptimizerService:
job.assigned_reservations = result.get("assigned_reservations", 0)
job.reservations = result.get("reservations", [])
job.conflicts = result.get("conflicts", [])
job.completed_at = datetime.utcnow()
job.completed_at = datetime.now(timezone.utc).replace(tzinfo=None)
job.execution_time_ms = exec_time_ms
try:
@@ -180,7 +181,7 @@ class OptimizerService:
with cls._lock:
job.status = OptimizerJobStatus.FAILED
job.error = str(ex)
job.completed_at = datetime.utcnow()
job.completed_at = datetime.now(timezone.utc).replace(tzinfo=None)
@classmethod
def get_job(cls, job_id: str) -> Optional[OptimizerJob]:
@@ -278,5 +279,5 @@ class OptimizerService:
"conflictCount": len(best_individual.conflicts),
"fitnessScore": round(best_individual.fitness, 2),
"executionTimeMs": exec_ms,
"timestamp": datetime.utcnow().isoformat() + "Z"
"timestamp": datetime.now(timezone.utc).isoformat()
}