Fix failed user lookup
The kiosk is fucked, fix it later
This commit is contained in:
parent
55be2a898b
commit
5e304826ca
1 changed files with 11 additions and 8 deletions
19
app/views.py
19
app/views.py
|
@ -135,6 +135,7 @@ def kiosk():
|
||||||
|
|
||||||
@app.route('/kiosk/data', methods=['GET'])
|
@app.route('/kiosk/data', methods=['GET'])
|
||||||
def kiosk_data():
|
def kiosk_data():
|
||||||
|
global after_date
|
||||||
swipes = db.session.query(Swipe).filter(Swipe.time >= after_date)
|
swipes = db.session.query(Swipe).filter(Swipe.time >= after_date)
|
||||||
|
|
||||||
counts = {}
|
counts = {}
|
||||||
|
@ -157,17 +158,19 @@ def kiosk_data():
|
||||||
tz = timezone('EST')
|
tz = timezone('EST')
|
||||||
est = dt.astimezone(tz)
|
est = dt.astimezone(tz)
|
||||||
|
|
||||||
user = db.session.query(User).filter(User.uuid == swipe.uuid).first()
|
|
||||||
|
|
||||||
time_here = datetime.now() - dt
|
time_here = datetime.now() - dt
|
||||||
time_here_str = f'{time_here.seconds//3600}:{(time_here.seconds//60)%60:02d}'
|
time_here_str = f'{time_here.seconds//3600}:{(time_here.seconds//60)%60:02d}'
|
||||||
|
|
||||||
rec = {
|
print(swipe.uuid)
|
||||||
'first_name': user.first_name,
|
user = db.session.query(User).filter(User.uuid == swipe.uuid).first()
|
||||||
'last_name': user.last_name,
|
|
||||||
'time_here': time_here_str
|
if user:
|
||||||
}
|
rec = {
|
||||||
res.append(rec)
|
'first_name': user.first_name,
|
||||||
|
'last_name': user.last_name,
|
||||||
|
'time_here': time_here_str
|
||||||
|
}
|
||||||
|
res.append(rec)
|
||||||
return json.dumps(res)
|
return json.dumps(res)
|
||||||
|
|
||||||
@app.route('/report', methods=['GET', 'POST'])
|
@app.route('/report', methods=['GET', 'POST'])
|
||||||
|
|
Loading…
Reference in a new issue