fix: fix employee logged in when only one attendance registration is found

This commit is contained in:
Marcel Arndt 2025-07-02 15:26:45 +02:00
parent 8ec8d481b8
commit b4ccd1ed76
1 changed files with 4 additions and 2 deletions

View File

@ -10,7 +10,7 @@ import {
isBefore,
isWithinInterval,
set,
subMilliseconds
subMilliseconds,
} from 'date-fns';
import { getTimezoneOffset, toZonedTime } from 'date-fns-tz';
@ -303,7 +303,8 @@ export class EmployeesLoggedInDetector extends AnomalyDetector {
isBefore(lastClockedOut.dateTime, firstClockedIn.dateTime)
) {
return [
false,
isBefore(firstClockedIn.dateTime, datetimeToCheckWithBuffer) ||
isBefore(firstClockedIn.dateTime, datetimeToCheck),
{
start: firstClockedIn.dateTime,
end: undefined,
@ -320,6 +321,7 @@ export class EmployeesLoggedInDetector extends AnomalyDetector {
start: new Date(firstClockedIn.dateTime),
end: new Date(lastClockedOut.dateTime),
};
return [
isWithinInterval(datetimeToCheckWithBuffer, interval) ||
isWithinInterval(datetimeToCheck, interval),