Showing
1 changed file
with
9 additions
and
6 deletions
... | @@ -151,9 +151,11 @@ async def thread(websocket, path): | ... | @@ -151,9 +151,11 @@ async def thread(websocket, path): |
151 | 151 | ||
152 | # TODO: lecture DB에 tuple 삽입해야 아래 코드가 돌아감 | 152 | # TODO: lecture DB에 tuple 삽입해야 아래 코드가 돌아감 |
153 | # 해당하는 사람이 DB에 있으면 출석 처리 | 153 | # 해당하는 사람이 DB에 있으면 출석 처리 |
154 | - #date = datetime.now().strftime('%Y-%m-%d') | 154 | + # 테이블 맨 뒤에 datetime attribute가 있음. 서버 시간 가져오게 default로 설정해둠. |
155 | - #sql = "INSERT INTO student_attendance(lecture_id, student_id, date, status) VALUES (%s, %s, %s, %s)" | 155 | + #sql = "INSERT INTO student_attendance(lecture_id, student_id, status) VALUES (%s, %s, %s, %s)" |
156 | - #cursor.execute(sql, ('0', verified_id, date, 'attend')) | 156 | + |
157 | + # TODO: attend / late 처리 | ||
158 | + #cursor.execute(sql, ('0', verified_id, 'attend')) | ||
157 | 159 | ||
158 | # client에 전달 | 160 | # client에 전달 |
159 | send = json.dumps({'status': 'success', 'student_id': verified_id}) | 161 | send = json.dumps({'status': 'success', 'student_id': verified_id}) |
... | @@ -166,12 +168,13 @@ async def thread(websocket, path): | ... | @@ -166,12 +168,13 @@ async def thread(websocket, path): |
166 | 168 | ||
167 | arr = np.asarray(data['image'], dtype = np.uint8) | 169 | arr = np.asarray(data['image'], dtype = np.uint8) |
168 | blob = arr.tobytes() | 170 | blob = arr.tobytes() |
169 | - date = datetime.now().strftime('%Y-%m-%d') | 171 | + #datetime = datetime.now().strftime('%Y-%m-%d %H:%M:%S') |
170 | 172 | ||
171 | # TODO: lecture DB에 tuple 삽입해야 아래 코드가 돌아감 | 173 | # TODO: lecture DB에 tuple 삽입해야 아래 코드가 돌아감 |
174 | + # 테이블 맨 뒤에 datetime attribute가 있음. 서버 시간 가져오게 default로 설정해둠. | ||
172 | #cursor = attendance_db.cursor(pymysql.cursors.DictCursor) | 175 | #cursor = attendance_db.cursor(pymysql.cursors.DictCursor) |
173 | - #sql = "INSERT INTO undefined_image(lecture_id, date, image, width, height) VALUES (%s, %s, _binary %s, %s, %s)" | 176 | + #sql = "INSERT INTO undefined_image(lecture_id, datetime, image, width, height) VALUES (%s, %s, _binary %s, %s, %s)" |
174 | - #cursor.execute(sql, ('0', date, blob, arr.shape[0], arr.shape[1])) | 177 | + #cursor.execute(sql, ('0', datetime, blob, arr.shape[0], arr.shape[1])) |
175 | #attendance_db.commit() | 178 | #attendance_db.commit() |
176 | else: | 179 | else: |
177 | print("unsupported event: {}", data) | 180 | print("unsupported event: {}", data) | ... | ... |
-
Please register or login to post a comment