@outbuild-company/schedule-core 1.10.2 → 1.10.3
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.
- package/dist/cdn/schedule-core.global.js +1 -1
- package/dist/cdn/schedule-core.global.js.map +1 -1
- package/dist/index.cjs +47 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9703,13 +9703,41 @@ async function createGanttAdapter(state, hoursPerDay) {
|
|
|
9703
9703
|
|
|
9704
9704
|
// src/critical-path/run-critical-path.ts
|
|
9705
9705
|
var CP_WRITE_YIELD_EVERY = 1e3;
|
|
9706
|
-
|
|
9707
|
-
|
|
9706
|
+
var finiteHoursOrNull = (value) => {
|
|
9707
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
9708
|
+
return Object.is(value, -0) ? 0 : value;
|
|
9709
|
+
};
|
|
9710
|
+
var linkFreeFloatDaysToHours = (valueDays, hoursPerDay) => {
|
|
9711
|
+
if (typeof valueDays !== "number" || valueDays < 0) return null;
|
|
9712
|
+
return slackDaysToHours(valueDays, hoursPerDay);
|
|
9713
|
+
};
|
|
9714
|
+
function fieldsForLink(input) {
|
|
9715
|
+
const freeSlackHours = linkFreeFloatDaysToHours(
|
|
9716
|
+
input.freeFloatDays,
|
|
9717
|
+
input.hoursPerDay
|
|
9718
|
+
);
|
|
9719
|
+
const residualHours = finiteHoursOrNull(input.residualHours);
|
|
9708
9720
|
return {
|
|
9709
9721
|
freeSlackHours,
|
|
9710
|
-
isCritical:
|
|
9722
|
+
isCritical: residualHours !== null && residualHours <= 0 && input.sourceIsCritical && input.targetIsCritical && input.targetProgress === 0
|
|
9711
9723
|
};
|
|
9712
9724
|
}
|
|
9725
|
+
async function collectLinkFreeFloatDays(freeFloat, isCurrent) {
|
|
9726
|
+
const values = /* @__PURE__ */ new Map();
|
|
9727
|
+
let sinceYield = 0;
|
|
9728
|
+
for (const calculation of freeFloat.values()) {
|
|
9729
|
+
for (const linkId in calculation.linksFreeFloat) {
|
|
9730
|
+
if (!Object.hasOwn(calculation.linksFreeFloat, linkId)) continue;
|
|
9731
|
+
if (++sinceYield >= CP_WRITE_YIELD_EVERY) {
|
|
9732
|
+
sinceYield = 0;
|
|
9733
|
+
await yieldToBrowser();
|
|
9734
|
+
if (!isCurrent()) return null;
|
|
9735
|
+
}
|
|
9736
|
+
values.set(String(linkId), calculation.linksFreeFloat[linkId]);
|
|
9737
|
+
}
|
|
9738
|
+
}
|
|
9739
|
+
return isCurrent() ? values : null;
|
|
9740
|
+
}
|
|
9713
9741
|
async function collectActivityFields(state, maps, hoursPerDay, toCanonicalActivityId, isCurrent) {
|
|
9714
9742
|
const fields = /* @__PURE__ */ new Map();
|
|
9715
9743
|
let sinceYield = 0;
|
|
@@ -9735,7 +9763,7 @@ async function collectActivityFields(state, maps, hoursPerDay, toCanonicalActivi
|
|
|
9735
9763
|
}
|
|
9736
9764
|
return isCurrent() ? fields : null;
|
|
9737
9765
|
}
|
|
9738
|
-
async function collectLinkFields(state, linkResidualHours, activityFields, isCurrent) {
|
|
9766
|
+
async function collectLinkFields(state, linkFreeFloatDays, linkResidualHours, activityFields, hoursPerDay, isCurrent) {
|
|
9739
9767
|
const fields = /* @__PURE__ */ new Map();
|
|
9740
9768
|
let sinceYield = 0;
|
|
9741
9769
|
for (const link of state.getAllLinks()) {
|
|
@@ -9746,12 +9774,14 @@ async function collectLinkFields(state, linkResidualHours, activityFields, isCur
|
|
|
9746
9774
|
}
|
|
9747
9775
|
fields.set(
|
|
9748
9776
|
String(link.id),
|
|
9749
|
-
fieldsForLink(
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9777
|
+
fieldsForLink({
|
|
9778
|
+
freeFloatDays: linkFreeFloatDays.get(String(link.id)),
|
|
9779
|
+
residualHours: linkResidualHours.get(String(link.id)),
|
|
9780
|
+
hoursPerDay,
|
|
9781
|
+
sourceIsCritical: activityFields.get(link.source)?.isCritical === true,
|
|
9782
|
+
targetIsCritical: activityFields.get(link.target)?.isCritical === true,
|
|
9783
|
+
targetProgress: state.getActivity(link.target)?.progress
|
|
9784
|
+
})
|
|
9755
9785
|
);
|
|
9756
9786
|
}
|
|
9757
9787
|
return isCurrent() ? fields : null;
|
|
@@ -9834,10 +9864,17 @@ async function computeCriticalPathFields(state, hoursPerDay, isCurrent = () => t
|
|
|
9834
9864
|
isCurrent
|
|
9835
9865
|
);
|
|
9836
9866
|
if (!activities) return null;
|
|
9867
|
+
const linkFreeFloatDays = await collectLinkFreeFloatDays(
|
|
9868
|
+
maps.freeFloat,
|
|
9869
|
+
isCurrent
|
|
9870
|
+
);
|
|
9871
|
+
if (!linkFreeFloatDays) return null;
|
|
9837
9872
|
const links = await collectLinkFields(
|
|
9838
9873
|
state,
|
|
9874
|
+
linkFreeFloatDays,
|
|
9839
9875
|
criticalPath.linkResidualHours,
|
|
9840
9876
|
activities,
|
|
9877
|
+
hoursPerDay,
|
|
9841
9878
|
isCurrent
|
|
9842
9879
|
);
|
|
9843
9880
|
return links ? { activities, links } : null;
|