@outbuild-company/schedule-core 1.23.0 → 1.24.0
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 +91 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +91 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11979,14 +11979,65 @@ function createOutbuildP6ActivityDraft(activity) {
|
|
|
11979
11979
|
if (state === void 0) return void 0;
|
|
11980
11980
|
return {
|
|
11981
11981
|
...state,
|
|
11982
|
-
|
|
11982
|
+
...outbuildProgressExecution(activity, activity.durationHours)
|
|
11983
11983
|
};
|
|
11984
11984
|
}
|
|
11985
|
-
|
|
11985
|
+
var COMPLETED_PHYSICAL_PERCENT = 100;
|
|
11986
|
+
var NOT_STARTED_PHYSICAL_PERCENT = 0;
|
|
11987
|
+
function outbuildProgressExecution(activity, originalDurationHours) {
|
|
11986
11988
|
if (activity.progress === NOT_STARTED_PROGRESS) {
|
|
11987
|
-
return
|
|
11989
|
+
return {
|
|
11990
|
+
executionStatus: P6_EXECUTION_STATUS.NOT_STARTED,
|
|
11991
|
+
actualStart: null,
|
|
11992
|
+
actualFinish: null,
|
|
11993
|
+
remainingDurationHours: originalDurationHours,
|
|
11994
|
+
physicalPercentComplete: NOT_STARTED_PHYSICAL_PERCENT,
|
|
11995
|
+
actualDurationHours: 0,
|
|
11996
|
+
atCompletionDurationHours: originalDurationHours,
|
|
11997
|
+
durationPercentComplete: 0
|
|
11998
|
+
};
|
|
11999
|
+
}
|
|
12000
|
+
const actualStart = cloneValidDate(activity.startDate, "actualStart");
|
|
12001
|
+
if (isCompletedProgress(activity.progress)) {
|
|
12002
|
+
const hasMeasurableDuration = originalDurationHours > 0;
|
|
12003
|
+
return {
|
|
12004
|
+
executionStatus: P6_EXECUTION_STATUS.COMPLETED,
|
|
12005
|
+
actualStart,
|
|
12006
|
+
actualFinish: cloneValidDate(activity.endDate, "actualFinish"),
|
|
12007
|
+
remainingDurationHours: 0,
|
|
12008
|
+
physicalPercentComplete: COMPLETED_PHYSICAL_PERCENT,
|
|
12009
|
+
actualDurationHours: originalDurationHours,
|
|
12010
|
+
atCompletionDurationHours: originalDurationHours,
|
|
12011
|
+
durationPercentComplete: hasMeasurableDuration ? COMPLETED_PHYSICAL_PERCENT : NOT_STARTED_PHYSICAL_PERCENT
|
|
12012
|
+
};
|
|
11988
12013
|
}
|
|
11989
|
-
return
|
|
12014
|
+
return {
|
|
12015
|
+
executionStatus: P6_EXECUTION_STATUS.IN_PROGRESS,
|
|
12016
|
+
actualStart,
|
|
12017
|
+
actualFinish: null,
|
|
12018
|
+
remainingDurationHours: originalDurationHours,
|
|
12019
|
+
physicalPercentComplete: activity.progress,
|
|
12020
|
+
actualDurationHours: 0,
|
|
12021
|
+
atCompletionDurationHours: originalDurationHours,
|
|
12022
|
+
durationPercentComplete: 0
|
|
12023
|
+
};
|
|
12024
|
+
}
|
|
12025
|
+
function awaitsOutbuildExecution(draft) {
|
|
12026
|
+
return draft.executionStatus === P6_EXECUTION_STATUS.NOT_STARTED && draft.actualStart === null;
|
|
12027
|
+
}
|
|
12028
|
+
function reconcileOutbuildProgress(activity, draft) {
|
|
12029
|
+
const isProgressed = activity.progress !== NOT_STARTED_PROGRESS;
|
|
12030
|
+
if (!isProgressed || !awaitsOutbuildExecution(draft)) return draft;
|
|
12031
|
+
const inferred = outbuildProgressExecution(
|
|
12032
|
+
activity,
|
|
12033
|
+
draft.originalDurationHours
|
|
12034
|
+
);
|
|
12035
|
+
const keepsRecordedRemaining = inferred.executionStatus === P6_EXECUTION_STATUS.IN_PROGRESS && draft.remainingDurationHours !== null;
|
|
12036
|
+
return {
|
|
12037
|
+
...draft,
|
|
12038
|
+
...inferred,
|
|
12039
|
+
...keepsRecordedRemaining ? { remainingDurationHours: draft.remainingDurationHours } : {}
|
|
12040
|
+
};
|
|
11990
12041
|
}
|
|
11991
12042
|
|
|
11992
12043
|
// src/p6/inactive-drafts.ts
|
|
@@ -12039,17 +12090,41 @@ function ordinaryInputChanges(before, activity) {
|
|
|
12039
12090
|
...before.startDate.getTime() !== activity.startDate.getTime() ? { plannedStart: new Date(activity.startDate) } : {},
|
|
12040
12091
|
...before.endDate.getTime() !== activity.endDate.getTime() ? { plannedFinish: new Date(activity.endDate) } : {},
|
|
12041
12092
|
...durationChanged ? { originalDurationHours: activity.durationHours } : {},
|
|
12042
|
-
...durationChanged || before.progress !== activity.progress ?
|
|
12093
|
+
...durationChanged || before.progress !== activity.progress ? executionInputChanges(before, activity, durationChanged) : {}
|
|
12043
12094
|
};
|
|
12044
12095
|
}
|
|
12045
|
-
function
|
|
12096
|
+
function executionInputChanges(before, activity, durationChanged) {
|
|
12046
12097
|
const current = activity.p6;
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
const
|
|
12098
|
+
const hasExplicitRemainingCorrection = current.remainingDurationHours !== before.p6.remainingDurationHours;
|
|
12099
|
+
if (hasExplicitRemainingCorrection) return {};
|
|
12100
|
+
const progressChanged = before.progress !== activity.progress;
|
|
12101
|
+
const resetsToNotStarted = progressChanged && activity.progress === NOT_STARTED_PROGRESS;
|
|
12102
|
+
if (awaitsOutbuildExecution(current) || resetsToNotStarted) {
|
|
12103
|
+
const originalDurationHours = durationChanged ? activity.durationHours : current.originalDurationHours;
|
|
12104
|
+
return outbuildProgressExecution(activity, originalDurationHours);
|
|
12105
|
+
}
|
|
12106
|
+
const isStarted = current.actualStart !== null;
|
|
12107
|
+
if (!isStarted || !progressChanged) return {};
|
|
12108
|
+
return startedProgressChanges(current, activity);
|
|
12109
|
+
}
|
|
12110
|
+
function startedProgressChanges(current, activity) {
|
|
12111
|
+
const mirrorsPhysicalPercent = current.percentCompleteType === P6_PERCENT_COMPLETE_TYPE.PHYSICAL;
|
|
12112
|
+
if (!isCompletedProgress(activity.progress)) {
|
|
12113
|
+
return {
|
|
12114
|
+
...current.actualFinish === null ? {} : {
|
|
12115
|
+
executionStatus: P6_EXECUTION_STATUS.IN_PROGRESS,
|
|
12116
|
+
actualFinish: null
|
|
12117
|
+
},
|
|
12118
|
+
...mirrorsPhysicalPercent ? { physicalPercentComplete: activity.progress } : {}
|
|
12119
|
+
};
|
|
12120
|
+
}
|
|
12121
|
+
const finishesAfterActualStart = current.actualStart !== null && activity.endDate.getTime() >= current.actualStart.getTime();
|
|
12122
|
+
if (current.actualFinish !== null || !finishesAfterActualStart) return {};
|
|
12050
12123
|
return {
|
|
12051
|
-
|
|
12052
|
-
|
|
12124
|
+
executionStatus: P6_EXECUTION_STATUS.COMPLETED,
|
|
12125
|
+
actualFinish: new Date(activity.endDate),
|
|
12126
|
+
remainingDurationHours: 0,
|
|
12127
|
+
physicalPercentComplete: COMPLETED_PROGRESS
|
|
12053
12128
|
};
|
|
12054
12129
|
}
|
|
12055
12130
|
|
|
@@ -26245,8 +26320,8 @@ var P6ActivityStatusError = class extends Error {
|
|
|
26245
26320
|
}
|
|
26246
26321
|
code;
|
|
26247
26322
|
};
|
|
26248
|
-
var
|
|
26249
|
-
var
|
|
26323
|
+
var COMPLETED_PHYSICAL_PERCENT2 = 100;
|
|
26324
|
+
var NOT_STARTED_PHYSICAL_PERCENT2 = 0;
|
|
26250
26325
|
function validateP6ActivityStatus(activity) {
|
|
26251
26326
|
validateRemainingDuration(activity.remainingDurationHours);
|
|
26252
26327
|
validateDates(activity);
|
|
@@ -26272,11 +26347,11 @@ function normalizeP6ActualDatePatch(current, patch) {
|
|
|
26272
26347
|
executionStatus,
|
|
26273
26348
|
...actualFinish !== null ? {
|
|
26274
26349
|
remainingDurationHours: 0,
|
|
26275
|
-
physicalPercentComplete:
|
|
26350
|
+
physicalPercentComplete: COMPLETED_PHYSICAL_PERCENT2
|
|
26276
26351
|
} : {},
|
|
26277
26352
|
...unStarting ? {
|
|
26278
26353
|
remainingDurationHours: current.originalDurationHours,
|
|
26279
|
-
physicalPercentComplete:
|
|
26354
|
+
physicalPercentComplete: NOT_STARTED_PHYSICAL_PERCENT2
|
|
26280
26355
|
} : {}
|
|
26281
26356
|
};
|
|
26282
26357
|
validateP6ActivityDraftStatus({ ...current, ...normalized2 });
|
|
@@ -30309,7 +30384,7 @@ function initializeDataDate(input, activities) {
|
|
|
30309
30384
|
function attachImportedDataDate(activities, imported, settings) {
|
|
30310
30385
|
for (const activity of activities) {
|
|
30311
30386
|
const importedP6 = Object.hasOwn(imported, activity.id) ? imported[activity.id] : void 0;
|
|
30312
|
-
const p6 = importedP6
|
|
30387
|
+
const p6 = importedP6 === void 0 ? createOutbuildP6ActivityDraft(activity) : reconcileOutbuildProgress(activity, importedP6);
|
|
30313
30388
|
if (p6 === void 0) continue;
|
|
30314
30389
|
activity.p6 = p6;
|
|
30315
30390
|
if (!hasActiveDataDate(settings)) continue;
|