@fluxhub/fluxhub-lib 19.0.115 → 19.0.116
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.
|
@@ -32445,67 +32445,55 @@ class win_log_v2 {
|
|
|
32445
32445
|
});
|
|
32446
32446
|
}
|
|
32447
32447
|
calculateCompletedStepsFromLogs() {
|
|
32448
|
-
// Extract unique step numbers from logs (operazione field may contain step info)
|
|
32449
|
-
// Common step numbers: 10, 20, 30, 40, 50, etc. (900+ are final states)
|
|
32450
32448
|
const stepNumbers = new Set();
|
|
32451
|
-
const
|
|
32452
|
-
//
|
|
32453
|
-
let previousStep = null;
|
|
32449
|
+
const transitionsMap = new Map();
|
|
32450
|
+
// Process logs to extract transitions from liv_ini → liv_fin
|
|
32454
32451
|
this.logs.forEach((log) => {
|
|
32455
|
-
// Check if this
|
|
32456
|
-
|
|
32457
|
-
|
|
32458
|
-
|
|
32459
|
-
|
|
32460
|
-
const transitionMatch = operazione.match(/(\d+)\s*(?:→|->|to|a)\s*(\d+)/i);
|
|
32461
|
-
if (transitionMatch) {
|
|
32462
|
-
const fromStep = parseInt(transitionMatch[1], 10);
|
|
32463
|
-
const toStep = parseInt(transitionMatch[2], 10);
|
|
32452
|
+
// Check if this log has transition data
|
|
32453
|
+
if (log.liv_ini != null && log.liv_fin != null) {
|
|
32454
|
+
const fromStep = parseInt(log.liv_ini, 10);
|
|
32455
|
+
const toStep = parseInt(log.liv_fin, 10);
|
|
32456
|
+
// Validate step numbers (10-890 range, exclude final states 900+)
|
|
32464
32457
|
if (fromStep >= 10 && fromStep < 900 && toStep >= 10) {
|
|
32465
32458
|
stepNumbers.add(fromStep);
|
|
32466
32459
|
if (toStep < 900) {
|
|
32467
32460
|
stepNumbers.add(toStep);
|
|
32468
32461
|
}
|
|
32469
|
-
//
|
|
32470
|
-
|
|
32471
|
-
|
|
32472
|
-
|
|
32473
|
-
|
|
32474
|
-
|
|
32475
|
-
|
|
32476
|
-
|
|
32477
|
-
|
|
32478
|
-
|
|
32479
|
-
|
|
32480
|
-
|
|
32481
|
-
|
|
32482
|
-
|
|
32483
|
-
|
|
32484
|
-
|
|
32485
|
-
if (stepNum >= 10 && stepNum < 900) {
|
|
32486
|
-
stepNumbers.add(stepNum);
|
|
32487
|
-
// If we have a previous step, create transition
|
|
32488
|
-
if (previousStep !== null && previousStep !== stepNum) {
|
|
32489
|
-
transitions.push({
|
|
32490
|
-
fromStep: previousStep,
|
|
32491
|
-
toStep: stepNum,
|
|
32492
|
-
user: log.nc || log.username || 'Sistema',
|
|
32493
|
-
date: this.formatDate(log.data_creazione)
|
|
32494
|
-
});
|
|
32495
|
-
}
|
|
32496
|
-
previousStep = stepNum;
|
|
32497
|
-
}
|
|
32498
|
-
});
|
|
32462
|
+
// Create unique key for this transition
|
|
32463
|
+
const transitionKey = `${fromStep}_${toStep}`;
|
|
32464
|
+
const timestamp = new Date(log.data_evento || log.data_creazione).getTime();
|
|
32465
|
+
// Check if we already have this transition
|
|
32466
|
+
const existing = transitionsMap.get(transitionKey);
|
|
32467
|
+
// Keep only the most recent transition for each fromStep → toStep
|
|
32468
|
+
if (!existing || timestamp > existing.timestamp) {
|
|
32469
|
+
transitionsMap.set(transitionKey, {
|
|
32470
|
+
fromStep: fromStep,
|
|
32471
|
+
toStep: toStep,
|
|
32472
|
+
user: log.idp || log.nc || log.username || 'Sistema',
|
|
32473
|
+
date: this.formatDate(log.data_evento || log.data_creazione),
|
|
32474
|
+
timestamp: timestamp
|
|
32475
|
+
});
|
|
32476
|
+
console.log(`Transition: ${fromStep} → ${toStep} by ${log.idp || log.nc} on ${this.formatDate(log.data_evento || log.data_creazione)}`);
|
|
32477
|
+
}
|
|
32499
32478
|
}
|
|
32500
32479
|
}
|
|
32501
32480
|
});
|
|
32502
|
-
// Add all steps less than current step (
|
|
32503
|
-
// Common step increments: 10, 20, 30, 40, 50...
|
|
32481
|
+
// Add all steps less than current step (fallback for sequential workflow)
|
|
32504
32482
|
for (let step = 10; step < this.currentStep && step < 900; step += 10) {
|
|
32505
32483
|
stepNumbers.add(step);
|
|
32506
32484
|
}
|
|
32485
|
+
// Convert map to array (without timestamp)
|
|
32486
|
+
const transitions = Array.from(transitionsMap.values()).map(t => ({
|
|
32487
|
+
fromStep: t.fromStep,
|
|
32488
|
+
toStep: t.toStep,
|
|
32489
|
+
user: t.user,
|
|
32490
|
+
date: t.date
|
|
32491
|
+
}));
|
|
32507
32492
|
this.completedSteps = Array.from(stepNumbers).sort((a, b) => a - b);
|
|
32508
32493
|
this.transitionData = transitions;
|
|
32494
|
+
console.log('Completed steps:', this.completedSteps);
|
|
32495
|
+
console.log('Transitions found:', transitions.length);
|
|
32496
|
+
console.log('Transition data:', this.transitionData);
|
|
32509
32497
|
}
|
|
32510
32498
|
formatDate(dateStr) {
|
|
32511
32499
|
if (!dateStr)
|