(20260110) Attendance-sync'ing ready with a manual attendance script also.

This commit is contained in:
2026-01-13 18:19:52 +05:30
parent 74619bdec8
commit e34fb3f86c
+5
View File
@@ -328,6 +328,7 @@ def sync_attendance_to_tcaoff(
# Start with a blank user to time mapping: # Start with a blank user to time mapping:
user_id_to_time = {} user_id_to_time = {}
status_count = defaultdict(int)
# For each unique user id, # For each unique user id,
# Check the no of times when he successfully triggered the attendance-punching device: # Check the no of times when he successfully triggered the attendance-punching device:
@@ -452,6 +453,7 @@ def sync_attendance_to_tcaoff(
elif 7.5 < hours_worked <= 10.0: status = "P" elif 7.5 < hours_worked <= 10.0: status = "P"
elif 2.5 < hours_worked <= 5.0: status = "H" elif 2.5 < hours_worked <= 5.0: status = "H"
else: status = "A" else: status = "A"
status_count[status] += 1
success = tcaoff.attendance_mark( success = tcaoff.attendance_mark(
tcaoff_creds, tcaoff_creds,
user_id = tcaoff_team["user_id"], user_id = tcaoff_team["user_id"],
@@ -462,6 +464,9 @@ def sync_attendance_to_tcaoff(
if success: response["success"] += 1 if success: response["success"] += 1
else: response["fail"] += 1 else: response["fail"] += 1
# Show the stats:
print("WORKING HOUR STATUS STATS:", json.to_string(status_count))
# Done here: # Done here:
print("TCAOFF-Cosec Attendance Sync.:", json.to_string(response)) print("TCAOFF-Cosec Attendance Sync.:", json.to_string(response))
return response return response