Graduate

Modify server.py

...@@ -92,7 +92,8 @@ async def thread(websocket, path): ...@@ -92,7 +92,8 @@ async def thread(websocket, path):
92 if not cursor.fetchone(): 92 if not cursor.fetchone():
93 sql = "INSERT INTO student(student_id, student_name) VALUES (%s, %s)" 93 sql = "INSERT INTO student(student_id, student_name) VALUES (%s, %s)"
94 cursor.execute(sql, (student_id, student_name)) 94 cursor.execute(sql, (student_id, student_name))
95 - attendance_db.commit() 95 + sql = "INSERT INTO lecture_students(lecture_id, student_id) VALUES (%s, %s)"
96 + cursor.execute(sql, ('0', student_id))
96 msg='[{ip}] {id} is registered'.format(ip=remote_ip, id=student_id) 97 msg='[{ip}] {id} is registered'.format(ip=remote_ip, id=student_id)
97 print(msg) 98 print(msg)
98 99
......