March 10 2026: changed overnight shift timeframe
This commit is contained in:
@@ -9337,7 +9337,7 @@ def _overnight_aware_sort_key(record):
|
|||||||
action = (record.action_description or '').lower()
|
action = (record.action_description or '').lower()
|
||||||
is_out = 'out' in action or 'checkout' in action
|
is_out = 'out' in action or 'checkout' in action
|
||||||
# Push early-morning check-outs past midnight to end of day order
|
# Push early-morning check-outs past midnight to end of day order
|
||||||
if is_out and t.hour <= 6:
|
if is_out and t.hour <= 3:
|
||||||
minutes += 24 * 60
|
minutes += 24 * 60
|
||||||
return minutes
|
return minutes
|
||||||
|
|
||||||
@@ -9674,15 +9674,15 @@ def export_time_attendance_excel(records, project_name_for_filename, date_range_
|
|||||||
_nxt_outs = [r for r in _next_recs if _is_out(r)]
|
_nxt_outs = [r for r in _next_recs if _is_out(r)]
|
||||||
|
|
||||||
# Day N must have an unmatched late check-in (more INs than OUTs,
|
# Day N must have an unmatched late check-in (more INs than OUTs,
|
||||||
# with at least one IN at or after 18:00)
|
# with at least one IN at or after 20:00)
|
||||||
if len(_day_ins) <= len(_day_outs):
|
if len(_day_ins) <= len(_day_outs):
|
||||||
continue
|
continue
|
||||||
_late_ins = [r for r in _day_ins if r.check_in_time.hour >= 18]
|
_late_ins = [r for r in _day_ins if r.check_in_time.hour >= 20]
|
||||||
if not _late_ins:
|
if not _late_ins:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Find early-morning OUTs (<=06:00) on Day N+1
|
# Find early-morning OUTs (<=03:00) on Day N+1
|
||||||
_early_outs = [r for r in _nxt_outs if r.check_in_time.hour <= 6]
|
_early_outs = [r for r in _nxt_outs if r.check_in_time.hour <= 3]
|
||||||
if not _early_outs:
|
if not _early_outs:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -10045,12 +10045,12 @@ def export_time_attendance_excel(records, project_name_for_filename, date_range_
|
|||||||
pair_hours = 'Missed Punch'
|
pair_hours = 'Missed Punch'
|
||||||
|
|
||||||
# Determine whether this is an overnight pair:
|
# Determine whether this is an overnight pair:
|
||||||
# check-in is late evening (>= 18:00) AND check-out is early morning (<= 06:00)
|
# check-in is late evening (>= 20:00) AND check-out is early morning (<= 03:00)
|
||||||
# Both records share the same check_in_date in the DB for this scenario.
|
# Both records share the same check_in_date in the DB for this scenario.
|
||||||
_is_overnight_pair = (
|
_is_overnight_pair = (
|
||||||
check_in_record and check_out_record and
|
check_in_record and check_out_record and
|
||||||
check_in_record.check_in_time.hour >= 18 and
|
check_in_record.check_in_time.hour >= 20 and
|
||||||
check_out_record.check_in_time.hour <= 6
|
check_out_record.check_in_time.hour <= 3
|
||||||
)
|
)
|
||||||
|
|
||||||
# Show daily total on last pair of last location
|
# Show daily total on last pair of last location
|
||||||
|
|||||||
@@ -484,8 +484,8 @@ class WorkingHoursCalculator:
|
|||||||
# check-out record to Day N so the pair resolves correctly.
|
# check-out record to Day N so the pair resolves correctly.
|
||||||
# Hours are attributed to the earlier day (Day N).
|
# Hours are attributed to the earlier day (Day N).
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
OVERNIGHT_CHECKIN_HOUR = 18 # Check-in must be at or after 6 PM
|
OVERNIGHT_CHECKIN_HOUR = 20 # Check-in must be at or after 8 PM
|
||||||
OVERNIGHT_CHECKOUT_HOUR = 6 # Check-out must be at or before 6 AM
|
OVERNIGHT_CHECKOUT_HOUR = 3 # Check-out must be at or before 3 AM
|
||||||
|
|
||||||
for work_type in ['regular', 'SP', 'PW', 'PT']:
|
for work_type in ['regular', 'SP', 'PW', 'PT']:
|
||||||
all_dates = sorted(daily_records_by_type[work_type].keys())
|
all_dates = sorted(daily_records_by_type[work_type].keys())
|
||||||
|
|||||||
Reference in New Issue
Block a user