diff --git a/tytocare_logs_extractor.py b/tytocare_logs_extractor.py index afbbe15..6bc0cc8 100644 --- a/tytocare_logs_extractor.py +++ b/tytocare_logs_extractor.py @@ -61,7 +61,7 @@ def main_loop(): global cursor if cursor: # Get all files in the source directory - files = glob.glob(SOURCE_DIR + '*.txt') + files = glob.glob(SOURCE_DIR + '**/*.txt', recursive=True) if files: for file in files: http_lines, enddate = extract_data_from_file(file) @@ -100,7 +100,12 @@ def main_loop(): # Insert data into the database insert_logpass = "INSERT INTO dbo.log_pass (account, cardno, line, sequence, station, machine, status, lastupdate, lastupdatedby) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" + cursor.execute(insert_logpass, ('G5', cardno + '_1', '', '', stage, machine, database_status, log_pass_lastupdate, 'cats')) + + update_card = "UPDATE dbo.card SET curtstation = ?, status = ? WHERE cardno = ?" + cursor.execute(update_card, (stage, database_status, cardno + '_1')) + conn.commit() print('History inserted successfully')