fix dual device and calendar display bug

This commit is contained in:
2026-07-13 04:02:23 -04:00
parent 42f75fecef
commit 96a6309ff6
10 changed files with 71 additions and 202 deletions
+24 -11
View File
@@ -123,14 +123,6 @@ def init_db(db_path: str | Path = DB_PATH) -> None:
minutes INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS rerun_events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
detected_date TEXT NOT NULL,
failed_test_ids_json TEXT NOT NULL,
estimated_rerun_minutes INTEGER NOT NULL,
rerun_during_day INTEGER
);
CREATE INDEX IF NOT EXISTS idx_tests_status ON tests(status);
CREATE INDEX IF NOT EXISTS idx_tests_priority ON tests(priority);
CREATE INDEX IF NOT EXISTS idx_schedules_date_shift ON schedules(scheduled_date, shift_index);
@@ -503,11 +495,32 @@ def get_schedule_week(start_date: str, db_path: str | Path = DB_PATH) -> list[Sc
FROM schedules s
JOIN tests t ON t.test_id = s.test_id AND t.device = s.device
WHERE s.schedule_version = ?
AND s.scheduled_date >= ?
AND s.scheduled_date < date(?, '+7 day')
AND (
(
s.scheduled_date >= ?
AND s.scheduled_date < date(?, '+7 day')
AND s.shift_index IN (2, 3)
)
OR (
s.scheduled_date > ?
AND s.scheduled_date < date(?, '+7 day')
AND s.shift_index = 1
)
OR (
s.scheduled_date = date(?, '+7 day')
AND s.shift_index = 1
)
)
ORDER BY s.scheduled_date, s.shift_index, s.sequence_in_shift
""",
(latest, start_date, start_date),
(
latest,
start_date,
start_date,
start_date,
start_date,
start_date,
),
).fetchall()
result: list[ScheduleRow] = []