aiden-shared-calculations-unified 1.0.6 → 1.0.7
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Aggregates sentiment data from social posts.
|
|
3
3
|
* This calculation ONLY uses the social post insights context, not portfolio data.
|
|
4
|
+
* UPDATED: To read sentiment from the `sentiment.overallSentiment` property.
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
class SocialSentimentAggregation {
|
|
@@ -36,7 +37,9 @@ class SocialSentimentAggregation {
|
|
|
36
37
|
this.totalPosts = posts.length;
|
|
37
38
|
|
|
38
39
|
for (const post of posts) {
|
|
39
|
-
|
|
40
|
+
// --- FIX: Read from the nested overallSentiment property ---
|
|
41
|
+
const sentiment = post.sentiment?.overallSentiment || 'Neutral';
|
|
42
|
+
// --- END FIX ---
|
|
40
43
|
|
|
41
44
|
// 1. Aggregate global sentiment counts
|
|
42
45
|
if (this.sentimentCounts.hasOwnProperty(sentiment)) {
|
|
@@ -109,4 +112,4 @@ class SocialSentimentAggregation {
|
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
module.exports = SocialSentimentAggregation;
|
|
115
|
+
module.exports = SocialSentimentAggregation;
|