From a7ef09cdc1bb1433a3fbb7838f7ba8419569371a Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Sat, 11 Mar 2023 10:40:10 +0530 Subject: [PATCH 1/2] fix: split attendance data by record size --- zk/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zk/base.py b/zk/base.py index f90f209..0ee87eb 100644 --- a/zk/base.py +++ b/zk/base.py @@ -1646,6 +1646,7 @@ def get_attendance(self): attendance = Attendance(user_id, timestamp, status, punch, uid) attendances.append(attendance) else: + record_size_int = int(record_size) while len(attendance_data) >= 40: uid, user_id, status, timestamp, punch, space = unpack(' Date: Wed, 15 Mar 2023 09:38:39 +0530 Subject: [PATCH 2/2] chore: clean up code --- zk/base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zk/base.py b/zk/base.py index 0ee87eb..9931fec 100644 --- a/zk/base.py +++ b/zk/base.py @@ -1608,7 +1608,7 @@ def get_attendance(self): if self.verbose: print ("WRN: no attendance data") return [] total_size = unpack("I", attendance_data[:4])[0] - record_size = total_size/self.records + record_size = total_size // self.records if self.verbose: print ("record_size is ", record_size) attendance_data = attendance_data[4:] if record_size == 8: @@ -1646,7 +1646,6 @@ def get_attendance(self): attendance = Attendance(user_id, timestamp, status, punch, uid) attendances.append(attendance) else: - record_size_int = int(record_size) while len(attendance_data) >= 40: uid, user_id, status, timestamp, punch, space = unpack('