bulltrackers-module 1.0.134 → 1.0.135

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.
@@ -165,7 +165,7 @@ async function runStandardComputationPass(date, calcs, passName, config, deps, r
165
165
  const docRef = deps.db.collection(config.resultsCollection).doc(dStr)
166
166
  .collection(config.resultsSubcollection).doc(calc.manifest.category)
167
167
  .collection(config.computationsSubcollection).doc(name);
168
-
168
+ console.log('Writing standard result for', name, 'on', dStr);
169
169
  standardWrites.push({ ref: docRef, data: standardResult });
170
170
  }
171
171
  success++;
@@ -232,6 +232,7 @@ async function runMetaComputationPass(date, calcs, passName, config, deps, fetch
232
232
  const docRef = deps.db.collection(config.resultsCollection).doc(dStr)
233
233
  .collection(config.resultsSubcollection).doc(mCalc.category)
234
234
  .collection(config.computationsSubcollection).doc(name);
235
+ console.log('Writing standard result for', name, 'on', dStr);
235
236
  standardWrites.push({ ref: docRef, data: standardResult });
236
237
  }
237
238
  success++;
@@ -56,7 +56,7 @@ async function handleUpdate(task, taskId, { logger, headerManager, proxyManager,
56
56
  let historyHeader = null; // Will be selected if needed
57
57
  if (!portfolioHeader) throw new Error("Could not select portfolio header.");
58
58
 
59
- let wasPortfolioSuccess = false, wasHistorySuccess = false, isPrivate = false;
59
+ let wasPortfolioSuccess = false, wasHistorySuccess = false, isPrivate = false, fetchHistory = false; // <-- FIX: 'fetchHistory' declared here
60
60
 
61
61
  try {
62
62
  // --- START MODIFICATION: Build promises conditionally ---
@@ -66,14 +66,14 @@ async function handleUpdate(task, taskId, { logger, headerManager, proxyManager,
66
66
  promisesToRun.push(proxyManager.fetch(portfolioUrl, { headers: portfolioHeader.header }));
67
67
 
68
68
  // 2. Conditionally fetch history
69
- let fetchHistory = false;
69
+ // let fetchHistory = false; // <-- FIX: This line is removed
70
70
  if (!historyFetchedForUser.has(userId)) {
71
71
  historyHeader = await headerManager.selectHeader(); // Select header just-in-time
72
72
  if (!historyHeader) {
73
73
  logger.log('WARN', `[UPDATE] Could not select history header for ${userId}, skipping history fetch for this batch.`);
74
74
  historyFetchedForUser.add(userId); // Add to set to prevent retries in this batch
75
75
  } else {
76
- fetchHistory = true;
76
+ fetchHistory = true; // <-- FIX: Assigns to outer scope variable
77
77
  historyFetchedForUser.add(userId); // Mark as fetched for this batch
78
78
  const historyUrl = `${config.ETORO_API_USERSTATS_URL}${username}/trades/oneYearAgo?CopyAsAsset=true`;
79
79
  promisesToRun.push(proxyManager.fetch(historyUrl, { headers: historyHeader.header }));
@@ -132,7 +132,7 @@ async function handleUpdate(task, taskId, { logger, headerManager, proxyManager,
132
132
  if (portfolioHeader) headerManager.updatePerformance(portfolioHeader.id, wasPortfolioSuccess);
133
133
 
134
134
  // --- MODIFICATION: Only update history header if we used it ---
135
- if (fetchHistory && historyHeader) headerManager.updatePerformance(historyHeader.id, wasHistorySuccess);
135
+ if (fetchHistory && historyHeader) headerManager.updatePerformance(historyHeader.id, wasHistorySuccess); // <-- FIX: This line now works
136
136
  // --- END MODIFICATION ---
137
137
  }
138
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.134",
3
+ "version": "1.0.135",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -27,6 +27,10 @@
27
27
  "calculations",
28
28
  "finance"
29
29
  ],
30
+ "scripts": {
31
+ "postpublish": "node ./auto-deploy.js",
32
+ "release": "node ./release.js"
33
+ },
30
34
  "dependencies": {
31
35
  "@google-cloud/firestore": "^7.11.3",
32
36
  "sharedsetup": "latest",
@@ -34,7 +38,11 @@
34
38
  "@google-cloud/pubsub": "latest",
35
39
  "express": "^4.19.2",
36
40
  "cors": "^2.8.5",
37
- "p-limit": "^3.1.0"
41
+ "p-limit": "^3.1.0",
42
+ "dotenv": "latest"
43
+ },
44
+ "devDependencies": {
45
+ "bulltracker-deployer": "file:../bulltracker-deployer"
38
46
  },
39
47
  "engines": {
40
48
  "node": ">=20"