From 86740dd31b9f61a636a56dd3e0065a3452587968 Mon Sep 17 00:00:00 2001 From: Daniel von Atzigen Date: Tue, 15 Oct 2024 10:30:43 +0200 Subject: [PATCH] Fix `has_finished` field collect endpoint --- api.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api.py b/api.py index 5d7aaae..fd2bb19 100644 --- a/api.py +++ b/api.py @@ -51,13 +51,20 @@ def collect( ) has_finished = result is not None - if has_finished and result.ok: + if not has_finished: return JSONResponse(status_code=status.HTTP_200_OK, content={ - "has_finished": has_finished, + "has_finished": False, + "data": None, + }) + + if result.ok: + return JSONResponse(status_code=status.HTTP_200_OK, content={ + "has_finished": True, "data": result.value, }) + return JSONResponse(status_code=status.HTTP_200_OK, content={ - "has_finished": has_finished, + "has_finished": True, "error": "Internal Server Error", })