gantt-task-react-powern 0.5.7 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -677,7 +677,7 @@ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
677
677
  }
678
678
  }, task.name + ": Planned dates: "), React.createElement("b", null, task.start.getMonth() + 1 + "/" + task.start.getDate() + "/" + task.start.getFullYear() + " - " + (task.end.getMonth() + 1) + "/" + task.end.getDate() + "/" + task.end.getFullYear()), task.end.getTime() - task.start.getTime() !== 0 && React.createElement("p", {
679
679
  className: styles$2.tooltipDefaultContainerParagraph
680
- }, "Duration: " + ~~((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React.createElement("p", {
680
+ }, "Duration: " + ~~Math.ceil((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React.createElement("p", {
681
681
  className: styles$2.tooltipDefaultContainerParagraph
682
682
  }, !!task.progress && "Progress: " + task.progress + " %"));else return React.createElement("div", {
683
683
  className: styles$2.tooltipDefaultContainer,
@@ -688,7 +688,7 @@ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
688
688
  }
689
689
  }, task.name + ": Actual dates: "), React.createElement("b", null, task.actualStart.getMonth() + 1 + "/" + task.actualStart.getDate() + "/" + task.actualStart.getFullYear() + " - " + (task.actualEnd.getMonth() + 1) + "/" + task.actualEnd.getDate() + "/" + task.actualEnd.getFullYear()), task.actualEnd.getTime() - task.actualStart.getTime() !== 0 && React.createElement("p", {
690
690
  className: styles$2.tooltipDefaultContainerParagraph
691
- }, "Duration: " + ~~((task.actualEnd.getTime() - task.actualStart.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React.createElement("p", {
691
+ }, "Duration: " + ~~Math.ceil((task.actualEnd.getTime() - task.actualStart.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React.createElement("p", {
692
692
  className: styles$2.tooltipDefaultContainerParagraph
693
693
  }, !!task.progress && "Progress: " + task.progress + " %"));
694
694
  };
@@ -3504,6 +3504,7 @@ function getCriticalPaths(leafTasks) {
3504
3504
  computeCriticalPath(sortedTaskList[_i4], taskMap);
3505
3505
  }
3506
3506
 
3507
+ console.debug(taskMap);
3507
3508
  var taskChainList = [];
3508
3509
 
3509
3510
  for (var _i5 = 0; _i5 < sortedTaskList.length; _i5++) {
@@ -3596,11 +3597,12 @@ function computeCriticalPath(taskID, taskMap) {
3596
3597
  taskMap[taskID].paths = [];
3597
3598
 
3598
3599
  for (var j = 0; j < dependents.length; j++) {
3599
- var duration = taskMap[dependents[j]].task.end.getTime() - taskMap[dependents[j]].task.start.getTime() - Math.max(taskMap[taskID].end - taskMap[dependents[j]].task.start.getTime(), 0);
3600
+ var depDuration = taskMap[dependents[j]].task.end.getTime() - taskMap[dependents[j]].task.start.getTime();
3601
+ var overlap = Math.max(taskMap[taskID].end - taskMap[dependents[j]].task.start.getTime(), 0);
3600
3602
  var paths = taskMap[dependents[j]].paths;
3601
3603
 
3602
3604
  for (var k = 0; k < paths.length; k++) {
3603
- var totalDuration = taskMap[taskID].end - taskMap[taskID].start + duration + paths[k].duration;
3605
+ var totalDuration = taskMap[taskID].end - taskMap[taskID].start - overlap + paths[k].duration;
3604
3606
 
3605
3607
  if (taskMap[taskID].paths.length < 2) {
3606
3608
  taskMap[taskID].paths.push({
@@ -3614,7 +3616,7 @@ function computeCriticalPath(taskID, taskMap) {
3614
3616
  taskMap[taskID].paths[0].task = dependents[j];
3615
3617
  taskMap[taskID].paths[0].parent = taskID;
3616
3618
  taskMap[taskID].paths[0].visited = false;
3617
- } else if (totalDuration > taskMap[taskID].paths[0].duration) {
3619
+ } else if (totalDuration > taskMap[taskID].paths[1].duration) {
3618
3620
  taskMap[taskID].paths[1].duration = totalDuration;
3619
3621
  taskMap[taskID].paths[1].task = dependents[j];
3620
3622
  taskMap[taskID].paths[1].parent = taskID;
@@ -3622,20 +3624,22 @@ function computeCriticalPath(taskID, taskMap) {
3622
3624
  }
3623
3625
  }
3624
3626
 
3627
+ var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap;
3628
+
3625
3629
  if (taskMap[taskID].paths.length < 2) {
3626
3630
  taskMap[taskID].paths.push({
3627
- duration: duration,
3631
+ duration: immediateChildDuration,
3628
3632
  task: dependents[j],
3629
3633
  parent: taskID,
3630
3634
  visited: false
3631
3635
  });
3632
- } else if (duration > taskMap[taskID].paths[0].duration) {
3633
- taskMap[taskID].paths[0].duration = duration;
3636
+ } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
3637
+ taskMap[taskID].paths[0].duration = immediateChildDuration;
3634
3638
  taskMap[taskID].paths[0].task = dependents[j];
3635
3639
  taskMap[taskID].paths[0].parent = taskID;
3636
3640
  taskMap[taskID].paths[0].visited = false;
3637
- } else if (duration > taskMap[taskID].paths[0].duration) {
3638
- taskMap[taskID].paths[1].duration = duration;
3641
+ } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
3642
+ taskMap[taskID].paths[1].duration = immediateChildDuration;
3639
3643
  taskMap[taskID].paths[1].task = dependents[j];
3640
3644
  taskMap[taskID].paths[1].parent = taskID;
3641
3645
  taskMap[taskID].paths[1].visited = false;