fix: calculate PREKOVREMENI as total hours minus regular 8h
PREKOVREMENI (overtime hours) is now correctly calculated as the difference between total work+travel hours and the standard 8-hour workday.
This commit is contained in:
@@ -320,6 +320,8 @@ export default function TaskCalendarWidget({ tasks = [], notes = [], workOrders
|
|||||||
totalHours += Number(entry.totalHours || 0);
|
totalHours += Number(entry.totalHours || 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const regularHours = 8;
|
||||||
|
const overtimeHours = Math.max(0, totalHours - regularHours);
|
||||||
rows.push({
|
rows.push({
|
||||||
key,
|
key,
|
||||||
clickable: false,
|
clickable: false,
|
||||||
@@ -332,8 +334,8 @@ export default function TaskCalendarWidget({ tasks = [], notes = [], workOrders
|
|||||||
joinUnique(locations) || '-',
|
joinUnique(locations) || '-',
|
||||||
startTimes.length ? formatTime(new Date(Math.min(...startTimes.map((item) => item.getTime())))) : '-',
|
startTimes.length ? formatTime(new Date(Math.min(...startTimes.map((item) => item.getTime())))) : '-',
|
||||||
endTimes.length ? formatTime(new Date(Math.max(...endTimes.map((item) => item.getTime())))) : '-',
|
endTimes.length ? formatTime(new Date(Math.max(...endTimes.map((item) => item.getTime())))) : '-',
|
||||||
'8',
|
formatHourValue(regularHours, '0'),
|
||||||
formatHourValue(totalHours, '0'),
|
formatHourValue(overtimeHours, '0'),
|
||||||
joinUnique(workOrderLabels) || '-',
|
joinUnique(workOrderLabels) || '-',
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user