show completed tests on calendar

This commit is contained in:
2026-07-15 14:56:40 -04:00
parent 0646daf235
commit 195d2b01ff
4 changed files with 15 additions and 12 deletions
+7 -9
View File
@@ -22,7 +22,7 @@ from watcher import configure_result_watcher, stop_result_watcher
APP_ROOT = Path(__file__).resolve().parent APP_ROOT = Path(__file__).resolve().parent
DB_PATH = APP_ROOT / "scheduler.db" DB_PATH = Path(os.getenv("DB_PATH", str(APP_ROOT / "scheduler.db")))
DUT = os.getenv("DUT", "CGW453").strip() DUT = os.getenv("DUT", "CGW453").strip()
REF = os.getenv("REF", "CGW452").strip() REF = os.getenv("REF", "CGW452").strip()
@@ -473,14 +473,12 @@ def get_schedule_week(start: str | None = None, version: int | None = None) -> d
raise HTTPException(status_code=404, detail=f"Schedule version {version} was not found") raise HTTPException(status_code=404, detail=f"Schedule version {version} was not found")
rows = db.get_schedule_week(week_start, selected_version, DB_PATH) rows = db.get_schedule_week(week_start, selected_version, DB_PATH)
# Log completed tests on the current schedule completed_rows = [row for row in rows if str(row.status).strip().lower() == "completed"]
completed_count = sum(1 for row in rows if row.status == 'completed') rerun_rows = [row for row in rows if str(row.status).strip().lower() == "rerun"]
if completed_count > 0: print(
print(f"[api] /schedule/week: {completed_count} test(s) marked as completed on calendar") f"[api] /schedule/week: completed={len(completed_rows)} rerun_required={len(rerun_rows)}"
for row in rows: )
if row.status == 'completed':
print(f" - {row.test_id} on {row.device} (scheduled {row.scheduled_date})")
all_rows = db.get_schedule_rows(selected_version, DB_PATH) all_rows = db.get_schedule_rows(selected_version, DB_PATH)
completion_date = max((row.scheduled_date for row in all_rows), default=None) completion_date = max((row.scheduled_date for row in all_rows), default=None)
+4 -1
View File
@@ -203,7 +203,10 @@ def upsert_tests(records: list[TestRecord], db_path: str | Path = DB_PATH) -> in
victim_band = excluded.victim_band, victim_band = excluded.victim_band,
throttled = excluded.throttled, throttled = excluded.throttled,
estimated_minutes = excluded.estimated_minutes, estimated_minutes = excluded.estimated_minutes,
status = excluded.status, status = CASE
WHEN tests.status IN ('completed', 'rerun') THEN tests.status
ELSE excluded.status
END,
excluded = excluded.excluded, excluded = excluded.excluded,
raw_payload = excluded.raw_payload, raw_payload = excluded.raw_payload,
station_testpoint_map = excluded.station_testpoint_map, station_testpoint_map = excluded.station_testpoint_map,
+2 -1
View File
@@ -7,9 +7,10 @@ services:
environment: environment:
HOST_BROWSE_ROOT: ${HOST_BROWSE_ROOT} HOST_BROWSE_ROOT: ${HOST_BROWSE_ROOT}
HOST_MOUNT_ROOT: /host HOST_MOUNT_ROOT: /host
DB_PATH: /app/runtime/scheduler.db
volumes: volumes:
- ${HOST_BROWSE_ROOT}:/host - ${HOST_BROWSE_ROOT}:/host
- scheduler-db:/app - scheduler-db:/app/runtime
expose: expose:
- "8000" - "8000"
restart: unless-stopped restart: unless-stopped
+2 -1
View File
@@ -47,7 +47,8 @@ function formatConfig(config) {
} }
export default function TestCard({ test }) { export default function TestCard({ test }) {
const style = STATUS_STYLES[test.status] ?? STATUS_STYLES.pending const normalizedStatus = String(test?.status ?? 'pending').trim().toLowerCase()
const style = STATUS_STYLES[normalizedStatus] ?? STATUS_STYLES.pending
const deviceAccentClass = getDeviceAccentClass(test.device) const deviceAccentClass = getDeviceAccentClass(test.device)
const cardRef = useRef(null) const cardRef = useRef(null)
const [tooltipPos, setTooltipPos] = useState({ top: '0px', left: '0px' }) const [tooltipPos, setTooltipPos] = useState({ top: '0px', left: '0px' })