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,
|
isBefore,
|
||||||
isWithinInterval,
|
isWithinInterval,
|
||||||
set,
|
set,
|
||||||
subMilliseconds
|
subMilliseconds,
|
||||||
} from 'date-fns';
|
} from 'date-fns';
|
||||||
import { getTimezoneOffset, toZonedTime } from 'date-fns-tz';
|
import { getTimezoneOffset, toZonedTime } from 'date-fns-tz';
|
||||||
|
|
||||||
@@ -303,7 +303,8 @@ export class EmployeesLoggedInDetector extends AnomalyDetector {
|
|||||||
isBefore(lastClockedOut.dateTime, firstClockedIn.dateTime)
|
isBefore(lastClockedOut.dateTime, firstClockedIn.dateTime)
|
||||||
) {
|
) {
|
||||||
return [
|
return [
|
||||||
false,
|
isBefore(firstClockedIn.dateTime, datetimeToCheckWithBuffer) ||
|
||||||
|
isBefore(firstClockedIn.dateTime, datetimeToCheck),
|
||||||
{
|
{
|
||||||
start: firstClockedIn.dateTime,
|
start: firstClockedIn.dateTime,
|
||||||
end: undefined,
|
end: undefined,
|
||||||
@@ -320,6 +321,7 @@ export class EmployeesLoggedInDetector extends AnomalyDetector {
|
|||||||
start: new Date(firstClockedIn.dateTime),
|
start: new Date(firstClockedIn.dateTime),
|
||||||
end: new Date(lastClockedOut.dateTime),
|
end: new Date(lastClockedOut.dateTime),
|
||||||
};
|
};
|
||||||
|
|
||||||
return [
|
return [
|
||||||
isWithinInterval(datetimeToCheckWithBuffer, interval) ||
|
isWithinInterval(datetimeToCheckWithBuffer, interval) ||
|
||||||
isWithinInterval(datetimeToCheck, interval),
|
isWithinInterval(datetimeToCheck, interval),
|
||||||
|
|||||||
Reference in New Issue
Block a user