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'])
|
||||
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'])
|
||||
|
|
Loading…
Reference in a new issue