Spaces:
Running on Zero
Running on Zero
| def make_store() -> list: | |
| return [] | |
| def save_run(store: list, record: dict) -> tuple[int, list]: | |
| run_id = store[-1]["id"] + 1 if store else 1 | |
| return run_id, store + [{"id": run_id, **record}] | |
| def get_runs(store: list, limit: int = 100) -> list[dict]: | |
| return list(reversed(store))[:limit] | |
| def get_run(store: list, run_id: int) -> dict | None: | |
| return next((r for r in store if r["id"] == run_id), None) | |
| def delete_run(store: list, run_id: int) -> list: | |
| return [r for r in store if r["id"] != run_id] | |
| def update_feedback(store: list, run_id: int, value: int) -> list: | |
| return [{**r, "feedback": value} if r["id"] == run_id else r for r in store] | |
| def update_feedback_comment(store: list, run_id: int, comment: str) -> list: | |
| return [{**r, "feedback_comment": comment} if r["id"] == run_id else r for r in store] | |