gantt-task-react-powern 0.5.9 → 0.6.1

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: " + ~~Math.ceil((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React.createElement("p", {
680
+ }, "Duration: " + ~~Math.round((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: " + ~~Math.ceil((task.actualEnd.getTime() - task.actualStart.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React.createElement("p", {
691
+ }, "Duration: " + ~~Math.round((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,7 +3504,6 @@ function getCriticalPaths(leafTasks) {
3504
3504
  computeCriticalPath(sortedTaskList[_i4], taskMap);
3505
3505
  }
3506
3506
 
3507
- console.debug(taskMap);
3508
3507
  var taskChainList = [];
3509
3508
 
3510
3509
  for (var _i5 = 0; _i5 < sortedTaskList.length; _i5++) {
@@ -3513,6 +3512,14 @@ function getCriticalPaths(leafTasks) {
3513
3512
  }
3514
3513
  }
3515
3514
 
3515
+ var printedList = taskChainList.map(function (elem) {
3516
+ var newElem = _extends({}, elem);
3517
+
3518
+ newElem.duration = Math.round(elem.duration / 86400000);
3519
+ return newElem;
3520
+ });
3521
+ console.debug(printedList);
3522
+
3516
3523
  if (taskChainList.length > 0) {
3517
3524
  taskChainList.sort(function (a, b) {
3518
3525
  return b.duration - a.duration;
@@ -3624,25 +3631,27 @@ function computeCriticalPath(taskID, taskMap) {
3624
3631
  }
3625
3632
  }
3626
3633
 
3627
- var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap;
3634
+ if (paths.length === 0) {
3635
+ var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap;
3628
3636
 
3629
- if (taskMap[taskID].paths.length < 2) {
3630
- taskMap[taskID].paths.push({
3631
- duration: immediateChildDuration,
3632
- task: dependents[j],
3633
- parent: taskID,
3634
- visited: false
3635
- });
3636
- } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
3637
- taskMap[taskID].paths[0].duration = immediateChildDuration;
3638
- taskMap[taskID].paths[0].task = dependents[j];
3639
- taskMap[taskID].paths[0].parent = taskID;
3640
- taskMap[taskID].paths[0].visited = false;
3641
- } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
3642
- taskMap[taskID].paths[1].duration = immediateChildDuration;
3643
- taskMap[taskID].paths[1].task = dependents[j];
3644
- taskMap[taskID].paths[1].parent = taskID;
3645
- taskMap[taskID].paths[1].visited = false;
3637
+ if (taskMap[taskID].paths.length < 2) {
3638
+ taskMap[taskID].paths.push({
3639
+ duration: immediateChildDuration,
3640
+ task: dependents[j],
3641
+ parent: taskID,
3642
+ visited: false
3643
+ });
3644
+ } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
3645
+ taskMap[taskID].paths[0].duration = immediateChildDuration;
3646
+ taskMap[taskID].paths[0].task = dependents[j];
3647
+ taskMap[taskID].paths[0].parent = taskID;
3648
+ taskMap[taskID].paths[0].visited = false;
3649
+ } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
3650
+ taskMap[taskID].paths[1].duration = immediateChildDuration;
3651
+ taskMap[taskID].paths[1].task = dependents[j];
3652
+ taskMap[taskID].paths[1].parent = taskID;
3653
+ taskMap[taskID].paths[1].visited = false;
3654
+ }
3646
3655
  }
3647
3656
  }
3648
3657
  }