fix top priority tests

This commit is contained in:
2026-07-15 15:48:02 -04:00
parent 99b919b5da
commit b5dd611f82
4 changed files with 101 additions and 22 deletions
+17 -1
View File
@@ -85,6 +85,8 @@ class CompileScheduleRequest(BaseModel):
daytime_testing_today: bool = False
dual_device_weekend_start_enabled: bool = False
dual_device_weekend_start_dates: list[str] = Field(default_factory=list)
top_priority_tests_dut: list[str] = Field(default_factory=list)
top_priority_tests_ref: list[str] = Field(default_factory=list)
top_priority_tests: list[str] = Field(default_factory=list)
lowest_priority_tests: list[str] = Field(default_factory=list)
@@ -394,9 +396,23 @@ def compile_schedule_endpoint(request: CompileScheduleRequest) -> dict[str, Any]
holiday_dates = db.list_holidays(DB_PATH)
top_priority_pairs: set[tuple[str, str]] = set()
for test_id in {item.strip() for item in request.top_priority_tests if item.strip()}:
dut_top_priority_ids = {item.strip() for item in request.top_priority_tests_dut if item.strip()}
ref_top_priority_ids = {item.strip() for item in request.top_priority_tests_ref if item.strip()}
# Backward compatibility: if only legacy top_priority_tests was sent,
# keep previous behavior by applying IDs to whichever device has that test.
if not dut_top_priority_ids and not ref_top_priority_ids and request.top_priority_tests:
for test_id in {item.strip() for item in request.top_priority_tests if item.strip()}:
if any(t.test_id == test_id and t.device == DUT for t in stored_tests):
dut_top_priority_ids.add(test_id)
if any(t.test_id == test_id and t.device == REF for t in stored_tests):
ref_top_priority_ids.add(test_id)
for test_id in dut_top_priority_ids:
if any(t.test_id == test_id and t.device == DUT for t in stored_tests):
top_priority_pairs.add((test_id, DUT))
for test_id in ref_top_priority_ids:
if any(t.test_id == test_id and t.device == REF for t in stored_tests):
top_priority_pairs.add((test_id, REF))