aiden-shared-calculations-unified 1.0.61 → 1.0.62
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.
|
@@ -98,10 +98,16 @@ class UserProfitabilityTracker {
|
|
|
98
98
|
|
|
99
99
|
// --- Now, update the sharded history ---
|
|
100
100
|
const shardIndex = parseInt(userId, 10) % NUM_SHARDS;
|
|
101
|
-
|
|
101
|
+
|
|
102
|
+
// --- START FIX for userHistory.push error ---
|
|
103
|
+
// The existing data is an object like { history: [...] }, not the array itself.
|
|
104
|
+
const userHistory = (existingData[shardIndex][userId] && existingData[shardIndex][userId].history)
|
|
105
|
+
? existingData[shardIndex][userId].history
|
|
106
|
+
: [];
|
|
107
|
+
// --- END FIX ---
|
|
102
108
|
|
|
103
109
|
// Store the decimal % pnl in the history
|
|
104
|
-
userHistory.push({ date: today, pnl: dailyAvgPnl });
|
|
110
|
+
userHistory.push({ date: today, pnl: dailyAvgPnl });
|
|
105
111
|
|
|
106
112
|
const shardKey = `user_profitability_shard_${shardIndex}`;
|
|
107
113
|
if (!results[shardKey]) results[shardKey] = {};
|