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", })