mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-30 19:29:57 +00:00
No empty logs and fixes some errors
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user