bulltrackers-module 1.0.603 → 1.0.604
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.
|
@@ -1935,39 +1935,51 @@ const checkDataStatus = async (db, userId) => {
|
|
|
1935
1935
|
let computationDate = null;
|
|
1936
1936
|
let fallbackWindowExhausted = false;
|
|
1937
1937
|
|
|
1938
|
-
// Determine which
|
|
1939
|
-
|
|
1938
|
+
// Determine which computations to check based on user type
|
|
1939
|
+
// Signed-in users always have SignedInUserProfileMetrics
|
|
1940
|
+
// If they're also a PI, they may have SignedInUserPIPersonalizedMetrics
|
|
1941
|
+
const computationNames = ['SignedInUserProfileMetrics'];
|
|
1940
1942
|
try {
|
|
1941
1943
|
await fetchPopularInvestorMasterList(db, userId);
|
|
1942
|
-
|
|
1944
|
+
// User is a PI, also check for PI-specific computation
|
|
1945
|
+
computationNames.push('SignedInUserPIPersonalizedMetrics');
|
|
1943
1946
|
} catch (e) {
|
|
1944
|
-
// User is not a PI,
|
|
1947
|
+
// User is not a PI, only check SignedInUserProfileMetrics
|
|
1945
1948
|
}
|
|
1946
1949
|
|
|
1947
1950
|
// Check for computation results in the last 7 days
|
|
1951
|
+
// Check all relevant computation names for this user
|
|
1948
1952
|
for (let i = 0; i < lookbackDays; i++) {
|
|
1949
1953
|
const checkDate = new Date(today);
|
|
1950
1954
|
checkDate.setDate(checkDate.getDate() - i);
|
|
1951
1955
|
const dateStr = checkDate.toISOString().split('T')[0];
|
|
1952
1956
|
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
.collection('
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1957
|
+
// Check each computation name
|
|
1958
|
+
for (const compName of computationNames) {
|
|
1959
|
+
try {
|
|
1960
|
+
const pageRef = db.collection('unified_insights')
|
|
1961
|
+
.doc(dateStr)
|
|
1962
|
+
.collection('results')
|
|
1963
|
+
.doc('popular-investor')
|
|
1964
|
+
.collection('computations')
|
|
1965
|
+
.doc(compName)
|
|
1966
|
+
.collection('pages')
|
|
1967
|
+
.doc(String(userId));
|
|
1968
|
+
|
|
1969
|
+
const pageSnap = await pageRef.get();
|
|
1970
|
+
if (pageSnap.exists) {
|
|
1971
|
+
computationDate = dateStr;
|
|
1972
|
+
break;
|
|
1973
|
+
}
|
|
1974
|
+
} catch (error) {
|
|
1975
|
+
// Continue checking other dates/computations
|
|
1976
|
+
console.error(`Error checking computation ${compName} for ${dateStr}:`, error);
|
|
1967
1977
|
}
|
|
1968
|
-
}
|
|
1969
|
-
|
|
1970
|
-
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
// If we found a computation date, stop checking
|
|
1981
|
+
if (computationDate) {
|
|
1982
|
+
break;
|
|
1971
1983
|
}
|
|
1972
1984
|
}
|
|
1973
1985
|
|
|
@@ -244,7 +244,12 @@ async function handleComputationTask(message, config, dependencies) {
|
|
|
244
244
|
computation,
|
|
245
245
|
getComputationDisplayName(computation),
|
|
246
246
|
true,
|
|
247
|
-
null
|
|
247
|
+
null,
|
|
248
|
+
{
|
|
249
|
+
collectionRegistry: dependencies.collectionRegistry,
|
|
250
|
+
config: config,
|
|
251
|
+
notificationType: 'userActionCompletions'
|
|
252
|
+
}
|
|
248
253
|
);
|
|
249
254
|
} catch (notifError) {
|
|
250
255
|
// Non-critical, log and continue
|
|
@@ -291,7 +296,12 @@ async function handleComputationTask(message, config, dependencies) {
|
|
|
291
296
|
computation,
|
|
292
297
|
getComputationDisplayName(computation),
|
|
293
298
|
false,
|
|
294
|
-
err.message
|
|
299
|
+
err.message,
|
|
300
|
+
{
|
|
301
|
+
collectionRegistry: dependencies.collectionRegistry,
|
|
302
|
+
config: config,
|
|
303
|
+
notificationType: 'userActionCompletions'
|
|
304
|
+
}
|
|
295
305
|
);
|
|
296
306
|
} catch (notifError) {
|
|
297
307
|
// Non-critical, log and continue
|