frontend
This commit is contained in:
+15
-1
@@ -47,6 +47,7 @@ class ScheduleRow:
|
||||
sequence_in_shift: int
|
||||
test_type: str
|
||||
rotation: str | None
|
||||
config: dict[str, dict[str, str | None]]
|
||||
status: str
|
||||
priority: int
|
||||
estimated_minutes: int
|
||||
@@ -479,11 +480,12 @@ def get_schedule_week(start_date: str, db_path: str | Path = DB_PATH) -> list[Sc
|
||||
s.sequence_in_shift,
|
||||
t.test_type,
|
||||
t.rotation,
|
||||
t.config_json,
|
||||
t.status,
|
||||
t.priority,
|
||||
t.estimated_minutes
|
||||
FROM schedules s
|
||||
JOIN tests t ON t.test_id = s.test_id
|
||||
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')
|
||||
@@ -503,6 +505,7 @@ def get_schedule_week(start_date: str, db_path: str | Path = DB_PATH) -> list[Sc
|
||||
sequence_in_shift=int(row["sequence_in_shift"]),
|
||||
test_type=row["test_type"],
|
||||
rotation=row["rotation"],
|
||||
config=json.loads(row["config_json"] or "{}"),
|
||||
status=row["status"],
|
||||
priority=int(row["priority"]),
|
||||
estimated_minutes=int(row["estimated_minutes"]),
|
||||
@@ -527,3 +530,14 @@ def mark_tests_completed(test_ids_with_device: list[tuple[str, str]], db_path: s
|
||||
test_ids_with_device,
|
||||
)
|
||||
|
||||
|
||||
def upsert_holidays(dates: list[str], db_path: str | Path = DB_PATH) -> None:
|
||||
"""Replace all holidays with the provided list of YYYY-MM-DD date strings."""
|
||||
with get_connection(db_path) as conn:
|
||||
conn.execute("DELETE FROM holidays")
|
||||
if dates:
|
||||
conn.executemany(
|
||||
"INSERT OR IGNORE INTO holidays(date) VALUES (?)",
|
||||
[(d,) for d in dates],
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user