mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
fix(calendar): fixed scheduled capacity calculation by considering work hours and task status
This commit is contained in:
1 parent
1df98087dd
commit
2b47abadfa
1 file changed
+26
-1
@@ -42,9 +42,34 @@ export default {
|
||||
} else if (selectedDate.isSame(moment(), 'days')) {
|
||||
totalScheduledTime += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||
// Today
|
||||
const isTaskCurrentlyInProgress = moment(task._real_start).isBefore(moment(), 'minutes') && moment(task._real_end).isAfter(moment(), 'minutes')
|
||||
const isTaskInFuture = moment(task._real_start).isAfter(moment(), 'minutes')
|
||||
|
||||
const isTaskDuringWorkHours = moment(task._real_start).hour() >= employee.work_start && moment(task._real_start).hour() <= employee.work_end
|
||||
|
||||
if (isTaskDuringWorkHours) {
|
||||
if (isTaskCurrentlyInProgress) {
|
||||
scheduledCapacityMinutes +=
|
||||
timelineUtils._getDifferenceInMinutes(
|
||||
moment(),
|
||||
task._real_end,
|
||||
);
|
||||
} else if (isTaskInFuture) {
|
||||
scheduledCapacityMinutes +=
|
||||
timelineUtils._getDifferenceInMinutes(
|
||||
task._real_end,
|
||||
task._real_start,
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scheduledCapacityMinutes += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||
// Future
|
||||
const isTaskDuringWorkHours = moment(task._real_start).hour() >= employee.work_start && moment(task._real_start).hour() <= employee.work_end
|
||||
|
||||
if (isTaskDuringWorkHours) {
|
||||
scheduledCapacityMinutes += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||
}
|
||||
|
||||
totalScheduledTime += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user