Skip to content

Commit 8abe043

Browse files
committed
Added a smiley / frown indicator
1 parent 03dc7ab commit 8abe043

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Fritz.StreamTools/Pages/Sentiment.cshtml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</head>
1414
<body>
1515
<div>
16-
<span id="currentSentiment"></span><i id="trend"></i>
16+
<i id="face" style="margin-right: 5px;"></i><span id="currentSentimentLabel">Current Sentiment:</span><span id="currentSentiment"></span><i id="trend"></i>
1717
</div>
1818
<div id="allSentiment"></div>
1919

@@ -26,6 +26,11 @@
2626
var sentimentEl = document.getElementById("currentSentiment");
2727
var allEl = document.getElementById("allSentiment");
2828
var trend = document.getElementById("trend");
29+
var face = document.getElementById("face");
30+
31+
const frown = "fas fa-frown";
32+
const smile = "fas fa-smile";
33+
2934
3035
hub.onSentiment = (instant, oneMinute, fiveMinute, all) => {
3136
@@ -36,9 +41,11 @@
3641
all: all
3742
});
3843
39-
sentimentEl.textContent = `Current Sentiment: ${(oneMinute * 100).toFixed(1)}`;
44+
face.className = instant >= 0.5 ? smile : frown;
45+
46+
sentimentEl.textContent = `${(oneMinute * 100).toFixed(1)}`;
4047
allEl.textContent = `Since start: ${(all * 100).toFixed(1)}`;
41-
trend.className = (fiveMinute < oneMinute) ? "fas fa-arrow-up" : (fiveMinute != oneMinute) ? "fas fa-arrow-down" : "fas arrows-alt-h";
48+
trend.className = (fiveMinute < oneMinute) ? "fas fa-arrow-up" : (fiveMinute != oneMinute) ? "fas fa-arrow-down" : "fa fa-arrows-h";
4249
4350
}
4451

Fritz.StreamTools/Services/SentimentService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public async Task Run()
8585
CalculateSentimentOverLastMinutes(5),
8686
CalculateSentimentOverLastMinutes());
8787

88-
8988
}
9089

9190
await Task.Delay(100);
@@ -96,6 +95,12 @@ public async Task Run()
9695

9796
private double CalculateSentimentOverLastMinutes(int numMinutes = 0) {
9897

98+
/*
99+
* roberttables cheer 100 February 12, 2019
100+
* ozcoder cheer 100 February 12, 2019
101+
* jamesmontemagno cheer 100 February 12, 2019
102+
*/
103+
99104
if (numMinutes > 0) {
100105
return _Observations.Where(o => o.Key > DateTime.Now.AddMinutes(-1 * numMinutes))
101106
.Average(v => v.Value.average);

0 commit comments

Comments
 (0)