diff --git a/app/modules/employees/service.py b/app/modules/employees/service.py index 92661d6..820764c 100644 --- a/app/modules/employees/service.py +++ b/app/modules/employees/service.py @@ -3263,8 +3263,16 @@ def _engagement_sla(subscription: ClientServiceSubscription | None, tasks: list[ if due_date is None: dates = [getattr(task, "internal_target_date", None) for task in tasks if getattr(task, "internal_target_date", None)] due_date = max(dates) if dates else None - started_dates = [getattr(task, "started_at_utc", None) for task in tasks if getattr(task, "started_at_utc", None)] - created_at = getattr(subscription, "created_at_utc", None) if subscription is not None else None + started_dates = [ + _as_utc_aware(getattr(task, "started_at_utc", None)) + for task in tasks + if getattr(task, "started_at_utc", None) + ] + created_at = ( + _as_utc_aware(getattr(subscription, "created_at_utc", None)) + if subscription is not None + else None + ) anchor = min(started_dates) if started_dates else created_at age_days = max((datetime.now(timezone.utc) - anchor).days, 0) if anchor else 0 days_remaining = (due_date - today).days if due_date else None