(20260119) Attendance now captures total hours, over-time hours, first in time, and last out time.

This commit is contained in:
2026-01-19 14:02:35 +05:30
parent 9640972085
commit 9423af0919
4 changed files with 139 additions and 8 deletions
+12 -2
View File
@@ -276,7 +276,7 @@ def sync_teams_to_tcaoff(
role = (cosec_team.get("Grade Name") or "Unknown").strip(),
username = tcaoff_username,
password = "Vispl@123",
application_notes = {"cosec": cosec_team}
applicant_notes = {"cosec": cosec_team}
)
# response["total"] += 1
if success: response["success"] += 1
@@ -397,6 +397,10 @@ def sync_attendance_to_tcaoff(
"work_date": last_dt
}
# Add fixed known details:
user_id_to_time[user_id]["first_in"] = first_in
user_id_to_time[user_id]["last_out"] = last_out
print("\n")
print("Result:")
print("------")
@@ -448,7 +452,7 @@ def sync_attendance_to_tcaoff(
continue
# Update the attendance on TCAOFF:
hours_worked = work["work_seconds"] / (60 * 60)
hours_worked = work["work_seconds"] // (60 * 60)
if hours_worked > 10.0: status = "OT"
elif 7.5 < hours_worked <= 10.0: status = "P"
elif 2.5 < hours_worked <= 5.0: status = "H"
@@ -460,6 +464,11 @@ def sync_attendance_to_tcaoff(
status = status,
over_time = max(0.0, hours_worked - 10.0),
attendance_date = work["work_date"],
json_notes = {
"totHours": hours_worked,
"firstIn": work["first_in"],
"lastOut": work["last_out"],
}
)
if success: response["success"] += 1
else: response["fail"] += 1
@@ -935,6 +944,7 @@ if __name__ == "__main__":
"deptAdd": "https://api.thecaoffice.com/commons/departments/add",
"teamList": "https://api.thecaoffice.com/team/list",
"teamAdd": "https://api.thecaoffice.com/team/add",
"teamUpdate": "https://api.thecaoffice.com/team/update",
"attendanceList": "https://api.thecaoffice.com/user/attendance/register",
"attendanceMark": "https://api.thecaoffice.com/user/attendance/mark"
}