Showing
3 changed files
with
12 additions
and
10 deletions
... | @@ -65,14 +65,16 @@ def register(): | ... | @@ -65,14 +65,16 @@ def register(): |
65 | print(msg) | 65 | print(msg) |
66 | sql = "SELECT student_id FROM student WHERE student_id = %s;" | 66 | sql = "SELECT student_id FROM student WHERE student_id = %s;" |
67 | cursor.execute(sql, (student_id)) | 67 | cursor.execute(sql, (student_id)) |
68 | - if cursor.rowcount == 0: | 68 | + if cursor.rowcount > 0: |
69 | - sql = "INSERT INTO student(student_id, student_name) VALUES (%s, %s)" | 69 | + send = jsonify({'status': 'already', 'student_id': student_id}) |
70 | - cursor.execute(sql, (student_id, student_name)) | 70 | + return send |
71 | - sql = "INSERT INTO lecture_students(lecture_id, student_id) VALUES (%s, %s)" | 71 | + sql = "INSERT INTO student(student_id, student_name) VALUES (%s, %s)" |
72 | - # temp: student in lecture 0 | 72 | + cursor.execute(sql, (student_id, student_name)) |
73 | - cursor.execute(sql, ('0', student_id)) | 73 | + sql = "INSERT INTO lecture_students(lecture_id, student_id) VALUES (%s, %s)" |
74 | - msg='[{id}] is registered'.format(id=student_id) | 74 | + # temp: student in lecture 0 |
75 | - print(msg) | 75 | + cursor.execute(sql, ('0', student_id)) |
76 | + msg='[{id}] is registered'.format(id=student_id) | ||
77 | + print(msg) | ||
76 | # image to input tensor | 78 | # image to input tensor |
77 | image = base64.b64decode(request.form['image']) | 79 | image = base64.b64decode(request.form['image']) |
78 | image_np = np.frombuffer(image, dtype=np.uint8) | 80 | image_np = np.frombuffer(image, dtype=np.uint8) | ... | ... |
... | @@ -216,7 +216,7 @@ function main() | ... | @@ -216,7 +216,7 @@ function main() |
216 | <div> | 216 | <div> |
217 | <!-- Header --> | 217 | <!-- Header --> |
218 | <header class="w3-container w3-center w3-padding-32"> | 218 | <header class="w3-container w3-center w3-padding-32"> |
219 | - <h1><b>얼굴 등록</b></h1> | 219 | + <h1><b>얼굴 인식 출석 시스템</b></h1> |
220 | <p>Made by <span class="w3-tag">정해갑</span></p> | 220 | <p>Made by <span class="w3-tag">정해갑</span></p> |
221 | </header> | 221 | </header> |
222 | </div> | 222 | </div> | ... | ... |
-
Please register or login to post a comment