diff --git a/scripts/common.py b/scripts/common.py index 771b636..72a18de 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -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 diff --git a/scripts/manual_attendance.py b/scripts/manual_attendance.py index cf5d86b..16e85aa 100644 --- a/scripts/manual_attendance.py +++ b/scripts/manual_attendance.py @@ -191,7 +191,7 @@ if __name__ == "__main__": import argparse ap = argparse.ArgumentParser() ap.add_argument( - "--test", + "--test", "--test-mode", action = "store_true", default = False, )