diff --git a/app/views.py b/app/views.py index 4e45d7a..46295dd 100644 --- a/app/views.py +++ b/app/views.py @@ -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'])