(20260310) Modified the work computation to label the event as "In" or "Out" by even considering the label of the device.

This commit is contained in:
2026-03-10 13:18:39 +05:30
parent 172cfdc92d
commit fe752a0028
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -577,8 +577,13 @@ def compute_work_done(
punch_ts = punch_dt.timestamp()
punch_loc = row[" Device/Source Detail"]
# Figure out the event type:
loc_event_type = None
if punch_loc.lower().find("out") >= 0: loc_event_type = "Out"
io_event_type = row["I/O Type"] if loc_event_type is None else loc_event_type
# Handle the first in time:
if row["I/O Type"] == "In":
if io_event_type == "In":
if work_reports[user_id][punch_date].get("first_in") is None:
work_reports[user_id][punch_date]["first_in"] = punch_ts
work_reports[user_id][punch_date]["first_in_loc"] = punch_loc
@@ -589,7 +594,7 @@ def compute_work_done(
work_reports[user_id][punch_date]["last_in_loc"] = punch_loc
# Handle the last out time:
if row["I/O Type"] == "Out":
if io_event_type == "Out":
if work_reports[user_id][punch_date].get("first_in") is not None:
work_reports[user_id][punch_date]["last_out"] = punch_ts
work_reports[user_id][punch_date]["last_out_loc"] = punch_loc