Fix failed user lookup

The kiosk is fucked, fix it later
This commit is contained in:
Thomas Muller 2024-10-03 23:24:53 -04:00
parent 55be2a898b
commit 5e304826ca

View file

@ -135,6 +135,7 @@ def kiosk():
@app.route('/kiosk/data', methods=['GET'])
def kiosk_data():
global after_date
swipes = db.session.query(Swipe).filter(Swipe.time >= after_date)
counts = {}
@ -157,17 +158,19 @@ def kiosk_data():
tz = timezone('EST')
est = dt.astimezone(tz)
user = db.session.query(User).filter(User.uuid == swipe.uuid).first()
time_here = datetime.now() - dt
time_here_str = f'{time_here.seconds//3600}:{(time_here.seconds//60)%60:02d}'
rec = {
'first_name': user.first_name,
'last_name': user.last_name,
'time_here': time_here_str
}
res.append(rec)
print(swipe.uuid)
user = db.session.query(User).filter(User.uuid == swipe.uuid).first()
if user:
rec = {
'first_name': user.first_name,
'last_name': user.last_name,
'time_here': time_here_str
}
res.append(rec)
return json.dumps(res)
@app.route('/report', methods=['GET', 'POST'])