Graduate

Modify server.py

......@@ -151,9 +151,11 @@ async def thread(websocket, path):
# TODO: lecture DB에 tuple 삽입해야 아래 코드가 돌아감
# 해당하는 사람이 DB에 있으면 출석 처리
#date = datetime.now().strftime('%Y-%m-%d')
#sql = "INSERT INTO student_attendance(lecture_id, student_id, date, status) VALUES (%s, %s, %s, %s)"
#cursor.execute(sql, ('0', verified_id, date, 'attend'))
# 테이블 맨 뒤에 datetime attribute가 있음. 서버 시간 가져오게 default로 설정해둠.
#sql = "INSERT INTO student_attendance(lecture_id, student_id, status) VALUES (%s, %s, %s, %s)"
# TODO: attend / late 처리
#cursor.execute(sql, ('0', verified_id, 'attend'))
# client에 전달
send = json.dumps({'status': 'success', 'student_id': verified_id})
......@@ -166,12 +168,13 @@ async def thread(websocket, path):
arr = np.asarray(data['image'], dtype = np.uint8)
blob = arr.tobytes()
date = datetime.now().strftime('%Y-%m-%d')
#datetime = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
# TODO: lecture DB에 tuple 삽입해야 아래 코드가 돌아감
# 테이블 맨 뒤에 datetime attribute가 있음. 서버 시간 가져오게 default로 설정해둠.
#cursor = attendance_db.cursor(pymysql.cursors.DictCursor)
#sql = "INSERT INTO undefined_image(lecture_id, date, image, width, height) VALUES (%s, %s, _binary %s, %s, %s)"
#cursor.execute(sql, ('0', date, blob, arr.shape[0], arr.shape[1]))
#sql = "INSERT INTO undefined_image(lecture_id, datetime, image, width, height) VALUES (%s, %s, _binary %s, %s, %s)"
#cursor.execute(sql, ('0', datetime, blob, arr.shape[0], arr.shape[1]))
#attendance_db.commit()
else:
print("unsupported event: {}", data)
......