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