Add results viewer dashboard page
This commit is contained in:
@@ -70,6 +70,10 @@ class ITestRepository(ABC):
|
||||
def get_measurements_dataframe(self, run_id: UUID) -> pd.DataFrame | None:
|
||||
"""Retrieve measurements as pandas DataFrame."""
|
||||
|
||||
@abstractmethod
|
||||
def get_all_runs(self) -> list[TestRun]:
|
||||
"""Retrieve all test runs, ordered by started_at descending."""
|
||||
|
||||
|
||||
class SQLiteRepository(ITestRepository):
|
||||
"""SQLite-based repository for test data.
|
||||
@@ -357,3 +361,42 @@ class SQLiteRepository(ITestRepository):
|
||||
return None
|
||||
|
||||
return pd.read_parquet(parquet_path)
|
||||
|
||||
def get_all_runs(self) -> list[TestRun]:
|
||||
"""Retrieve all test runs, ordered by started_at descending.
|
||||
|
||||
Returns:
|
||||
List of all TestRun objects, newest first.
|
||||
"""
|
||||
with sqlite3.connect(self.db_path) as conn:
|
||||
conn.row_factory = sqlite3.Row
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute("""
|
||||
SELECT id, test_name, started_at, status, config_json,
|
||||
description, completed_at, operator, notes, created_at
|
||||
FROM test_runs
|
||||
ORDER BY started_at DESC
|
||||
""")
|
||||
|
||||
rows = cursor.fetchall()
|
||||
|
||||
return [
|
||||
TestRun(
|
||||
id=row["id"],
|
||||
test_name=row["test_name"],
|
||||
started_at=datetime.fromisoformat(row["started_at"]),
|
||||
status=TestStatus(row["status"]),
|
||||
config_json=row["config_json"],
|
||||
description=row["description"],
|
||||
completed_at=(
|
||||
datetime.fromisoformat(row["completed_at"])
|
||||
if row["completed_at"]
|
||||
else None
|
||||
),
|
||||
operator=row["operator"],
|
||||
notes=row["notes"],
|
||||
created_at=datetime.fromisoformat(row["created_at"]),
|
||||
)
|
||||
for row in rows
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user