bulltrackers-module 1.0.254 → 1.0.256
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Main Orchestrator. Coordinates the topological execution.
|
|
3
|
-
* UPDATED:
|
|
3
|
+
* UPDATED: Uses centralized AvailabilityChecker for strict UserType validation.
|
|
4
4
|
*/
|
|
5
5
|
const { normalizeName, DEFINITIVE_EARLIEST_DATES } = require('./utils/utils');
|
|
6
|
-
const { checkRootDataAvailability }
|
|
6
|
+
const { checkRootDataAvailability, checkRootDependencies } = require('./data/AvailabilityChecker');
|
|
7
7
|
const { fetchExistingResults } = require('./data/DependencyFetcher');
|
|
8
8
|
const { fetchComputationStatus, updateComputationStatus } = require('./persistence/StatusRepository');
|
|
9
9
|
const { StandardExecutor } = require('./executors/StandardExecutor');
|
|
@@ -64,22 +64,18 @@ function analyzeDateExecution(dateStr, calcsInPass, rootDataStatus, dailyStatus,
|
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (dep === 'history' && !rootDataStatus.hasHistory) missingRoots.push('history');
|
|
74
|
-
if (dep === 'price' && !rootDataStatus.hasPrices) missingRoots.push('price');
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (missingRoots.length > 0) {
|
|
67
|
+
// [FIX] Use the shared, strict checking logic from AvailabilityChecker
|
|
68
|
+
// This ensures 'speculator' calculations check 'speculatorPortfolio', etc.
|
|
69
|
+
const rootCheck = checkRootDependencies(calc, rootDataStatus);
|
|
70
|
+
|
|
71
|
+
if (!rootCheck.canRun) {
|
|
72
|
+
const missingStr = rootCheck.missing.join(', ');
|
|
79
73
|
if (!isTargetToday) {
|
|
80
|
-
|
|
74
|
+
// Historical missing data is usually permanent/impossible
|
|
75
|
+
markImpossible(`Missing Root Data: ${missingStr} (Historical)`);
|
|
81
76
|
} else {
|
|
82
|
-
|
|
77
|
+
// Today's missing data might just be late (Blocked)
|
|
78
|
+
report.blocked.push({ name: cName, reason: `Missing Root Data: ${missingStr} (Waiting)` });
|
|
83
79
|
}
|
|
84
80
|
continue;
|
|
85
81
|
}
|
|
@@ -79,7 +79,8 @@ async function checkRootDataAvailability(dateStr, config, dependencies, earliest
|
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
81
|
// 1. Try reading the Index
|
|
82
|
-
|
|
82
|
+
// FIX: Added 'await' here to resolve the Promise before checking .exists
|
|
83
|
+
const indexDoc = await db.collection(INDEX_COLLECTION).doc(dateStr).get();
|
|
83
84
|
|
|
84
85
|
if (indexDoc.exists) {
|
|
85
86
|
const data = indexDoc.data();
|