No empty logs and fixes some errors

This commit is contained in:
2025-06-18 15:05:47 +02:00
parent fbdfe86eee
commit d074c9bf27
7 changed files with 35 additions and 21 deletions

View File

@@ -17,13 +17,14 @@ def data():
application.last_image.seek(0)
application.last_image = io.BytesIO(request.data)
np = asyncio.run(process_image(image=data))
# Check if the found plate is allowed to exit
allowed = AllowedPlate.query.filter_by(plate=np).first() is not None
db.session.add( # Log the found numberplate and status
LoggedItem(plate=np, allowed=allowed, datetime=datetime.now())
)
db.session.commit()
allowed = False
if np != "":
# Check if the found plate is allowed to exit
allowed = AllowedPlate.query.filter_by(plate=np).first() is not None
db.session.add( # Log the found numberplate and status
LoggedItem(plate=np, allowed=allowed, datetime=datetime.now())
)
db.session.commit()
# Return decision to Pico
return jsonify(