bulltrackers-module 1.0.142 → 1.0.143
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.
|
@@ -168,12 +168,16 @@ function filterCalculations(standardCalcs, metaCalcs, rootDataStatus, existingRe
|
|
|
168
168
|
/** Stage 6: Initialize calculator instances */
|
|
169
169
|
function initializeCalculators(calcs, logger) { const state = {}; for (const c of calcs) { const name=normalizeName(c.name), Cl=c.class; if(typeof Cl==='function') try { const inst=new Cl(); inst.manifest=c; state[name]=inst; } catch(e){logger.warn(`Init failed ${name}`,{errorMessage:e.message}); state[name]=null;} else {logger.warn(`Class missing ${name}`); state[name]=null;} } return state; }
|
|
170
170
|
|
|
171
|
-
/** Stage 7: Load historical data required for calculations
|
|
172
|
-
|
|
171
|
+
/** * Stage 7: Load historical data required for calculations
|
|
172
|
+
* --- THIS FUNCTION IS NOW FIXED ---
|
|
173
|
+
*/
|
|
174
|
+
async function loadHistoricalData(date, calcs, config, deps, rootData) {
|
|
175
|
+
const { logger } = deps; // <--- THIS WAS THE MISSING LINE
|
|
176
|
+
const updated = {...rootData}, dStr=date.toISOString().slice(0,10); const tasks = [];
|
|
177
|
+
|
|
173
178
|
const needsYesterdayPortfolio = calcs.some(c => c.isHistorical && c.rootDataDependencies.includes('portfolio'));
|
|
174
179
|
const needsTodayHistory = calcs.some(c => c.rootDataDependencies.includes('history'));
|
|
175
180
|
const needsYesterdayHistory = calcs.some(c => c.isHistorical && c.rootDataDependencies.includes('history'));
|
|
176
|
-
// --- NEW: Add checks for historical insights and social ---
|
|
177
181
|
const needsYesterdayInsights = calcs.some(c => c.isHistorical && c.rootDataDependencies.includes('insights'));
|
|
178
182
|
const needsYesterdaySocial = calcs.some(c => c.isHistorical && c.rootDataDependencies.includes('social'));
|
|
179
183
|
|
|
@@ -196,7 +200,6 @@ async function loadHistoricalData(date, calcs, config, deps, rootData) { const u
|
|
|
196
200
|
updated.yesterdayHistoryData=await loadFullDayMap(config,deps,await getHistoryPartRefs(config,deps,prevStr));
|
|
197
201
|
})());
|
|
198
202
|
}
|
|
199
|
-
// --- NEW: Load historical insights/social ---
|
|
200
203
|
if(needsYesterdayInsights) {
|
|
201
204
|
tasks.push((async()=>{ const prev=new Date(date); prev.setUTCDate(prev.getUTCDate()-1); const prevStr=prev.toISOString().slice(0,10);
|
|
202
205
|
logger.log('INFO', `[PassRunner] Loading YESTERDAY insights data for ${prevStr}`);
|
|
@@ -287,7 +290,7 @@ async function runStandardComputationPass(date, calcs, passName, config, deps, r
|
|
|
287
290
|
// --- THIS IS THE CRITICAL CHANGE ---
|
|
288
291
|
// If 'calcs' is empty *because of the new filter*, this log won't even appear.
|
|
289
292
|
if (calcs.length === 0) {
|
|
290
|
-
logger.log('INFO', `[${passName}] No standard calcs to run for ${
|
|
293
|
+
logger.log('INFO', `[${passName}] No standard calcs to run for ${dStr} after filtering.`);
|
|
291
294
|
return;
|
|
292
295
|
}
|
|
293
296
|
// This log now only appears if there is *actually* work to do.
|