Fixed data missing case

This commit is contained in:
Maximilian Giller 2024-05-02 18:02:03 +02:00
parent 368052f713
commit 10255b966b

View file

@ -10,7 +10,7 @@ router = APIRouter()
file_path = "bettwaage.csv" file_path = "bettwaage.csv"
latest_values = None latest_values = []
zero_values = [0, 0, 0, 0] zero_values = [0, 0, 0, 0]
scale_values = [1, 1, 1, 1] scale_values = [1, 1, 1, 1]
@ -91,7 +91,7 @@ async def delete_file():
@router.post("/zero", tags=["calibration"]) @router.post("/zero", tags=["calibration"])
async def set_zero(): async def set_zero():
if latest_values is None: if not latest_values:
return HTMLResponse( return HTMLResponse(
status_code=400, content="Requiring data before setting zeros." status_code=400, content="Requiring data before setting zeros."
) )