bulltrackers-module 1.0.674 → 1.0.675

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,8 @@ 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 && Array.isArray(result.trending) && result.trending.length > 0) {
2062
- return result.trending;
2061
+ if (result && result.trending) {
2062
+ return Array.isArray(result.trending) ? result.trending : [];
2063
2063
  }
2064
2064
  } catch (e) {
2065
2065
  // Continue to next date
@@ -2081,8 +2081,8 @@ const fetchPopularInvestorCategories = async (db) => {
2081
2081
  const dateKey = checkDate.toISOString().split('T')[0];
2082
2082
  try {
2083
2083
  const result = await getComputationResults(db, 'PopularInvestorCategories', dateKey);
2084
- if (result && result.categories && typeof result.categories === 'object' && Object.keys(result.categories).length > 0) {
2085
- return result.categories;
2084
+ if (result && result.categories) {
2085
+ return typeof result.categories === 'object' ? result.categories : {};
2086
2086
  }
2087
2087
  } catch (e) {
2088
2088
  // Continue to next date
@@ -224,7 +224,7 @@ router.get('/computations', async (req, res) => {
224
224
 
225
225
  try {
226
226
  const checkData = await getComputationResults(db, compName, dateKey, userId);
227
- if (checkData && typeof checkData === 'object' && checkData[userCidStr] && Array.isArray(checkData[userCidStr])) {
227
+ if (checkData && typeof checkData === 'object' && checkData[userCidStr]) {
228
228
  data = checkData;
229
229
  foundData = true;
230
230
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.674",
3
+ "version": "1.0.675",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [