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);
|
||||
}
|
||||
|
||||
const regularHours = 8;
|
||||
const overtimeHours = Math.max(0, totalHours - regularHours);
|
||||
rows.push({
|
||||
key,
|
||||
clickable: false,
|
||||
@@ -332,8 +334,8 @@ export default function TaskCalendarWidget({ tasks = [], notes = [], workOrders
|
||||
joinUnique(locations) || '-',
|
||||
startTimes.length ? formatTime(new Date(Math.min(...startTimes.map((item) => item.getTime())))) : '-',
|
||||
endTimes.length ? formatTime(new Date(Math.max(...endTimes.map((item) => item.getTime())))) : '-',
|
||||
'8',
|
||||
formatHourValue(totalHours, '0'),
|
||||
formatHourValue(regularHours, '0'),
|
||||
formatHourValue(overtimeHours, '0'),
|
||||
joinUnique(workOrderLabels) || '-',
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user