bulltrackers-module 1.0.675 → 1.0.677

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.
@@ -2058,8 +2058,17 @@ const fetchTrendingPopularInvestors = async (db) => {
2058
2058
  const dateKey = checkDate.toISOString().split('T')[0];
2059
2059
  try {
2060
2060
  const result = await getComputationResults(db, 'TrendingPopularInvestors', dateKey);
2061
- if (result && result.trending) {
2062
- return Array.isArray(result.trending) ? result.trending : [];
2061
+ console.log(`[Trending] Got result for ${dateKey}:`, JSON.stringify(result).substring(0, 500));
2062
+ // If we got a result, return it (even if trending array is empty)
2063
+ if (result) {
2064
+ // Handle case where data is wrapped under "undefined" key
2065
+ let trending = result.trending;
2066
+ if (!trending && result.undefined && result.undefined.trending) {
2067
+ trending = result.undefined.trending;
2068
+ }
2069
+ trending = trending || [];
2070
+ console.log(`[Trending] Returning trending array with ${trending.length} items`);
2071
+ return trending;
2063
2072
  }
2064
2073
  } catch (e) {
2065
2074
  // Continue to next date
@@ -2068,6 +2077,7 @@ const fetchTrendingPopularInvestors = async (db) => {
2068
2077
  }
2069
2078
  }
2070
2079
  }
2080
+ console.log(`[Trending] No data found, returning empty array`);
2071
2081
  return [];
2072
2082
  };
2073
2083
 
@@ -2081,8 +2091,17 @@ const fetchPopularInvestorCategories = async (db) => {
2081
2091
  const dateKey = checkDate.toISOString().split('T')[0];
2082
2092
  try {
2083
2093
  const result = await getComputationResults(db, 'PopularInvestorCategories', dateKey);
2084
- if (result && result.categories) {
2085
- return typeof result.categories === 'object' ? result.categories : {};
2094
+ console.log(`[Categories] Got result for ${dateKey}:`, JSON.stringify(result).substring(0, 500));
2095
+ // If we got a result, return it (even if categories object is empty)
2096
+ if (result) {
2097
+ // Handle case where data is wrapped under "undefined" key
2098
+ let categories = result.categories;
2099
+ if (!categories && result.undefined && result.undefined.categories) {
2100
+ categories = result.undefined.categories;
2101
+ }
2102
+ categories = categories || {};
2103
+ console.log(`[Categories] Returning categories object with ${Object.keys(categories).length} keys`);
2104
+ return categories;
2086
2105
  }
2087
2106
  } catch (e) {
2088
2107
  // Continue to next date
@@ -2091,6 +2110,7 @@ const fetchPopularInvestorCategories = async (db) => {
2091
2110
  }
2092
2111
  }
2093
2112
  }
2113
+ console.log(`[Categories] No data found, returning empty object`);
2094
2114
  return {};
2095
2115
  };
2096
2116
 
@@ -224,10 +224,14 @@ router.get('/computations', async (req, res) => {
224
224
 
225
225
  try {
226
226
  const checkData = await getComputationResults(db, compName, dateKey, userId);
227
+ console.log(`[Recommended] Got result for ${dateKey}:`, JSON.stringify(checkData).substring(0, 500));
227
228
  if (checkData && typeof checkData === 'object' && checkData[userCidStr]) {
229
+ console.log(`[Recommended] Found user ${userCidStr} data in ${dateKey}`);
228
230
  data = checkData;
229
231
  foundData = true;
230
232
  break;
233
+ } else {
234
+ console.log(`[Recommended] User ${userCidStr} not found in ${dateKey}, available keys:`, checkData ? Object.keys(checkData).slice(0, 10) : 'no data');
231
235
  }
232
236
  } catch (e) {
233
237
  // Continue to next date
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.675",
3
+ "version": "1.0.677",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [