fix: fix employee logged in when only one attendance registration is found
This commit is contained in:
+4
-2
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user