You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2017/10/25 11:18:42 UTC

[kibble] branch master updated: weight happiness by max scoring mood

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git


The following commit(s) were added to refs/heads/master by this push:
     new 33703be  weight happiness by max scoring mood
33703be is described below

commit 33703be0dae34a88956eab4c3852f09083ca0be7
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Oct 25 13:18:35 2017 +0200

    weight happiness by max scoring mood
    
    if a mood scores very high, the weighting should adjust, so
    that values above 100 gets normalized to 100.
---
 api/pages/mail/mood.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/api/pages/mail/mood.py b/api/pages/mail/mood.py
index 07a21cb..887ffd4 100644
--- a/api/pages/mail/mood.py
+++ b/api/pages/mail/mood.py
@@ -219,10 +219,11 @@ def run(API, environ, indata, session):
             mood_compiled[k] = int(100 * int( (v / max(1,emls)) * 100) / max(1, global_mood_compiled.get(k, 100)))
     else:
         mood_compiled = global_mood_compiled
+    MAX = max(mood_compiled.values())
     bads = (mood_compiled.get('anger', 0)*1.25 + mood_compiled.get('fear', 0)*1.25 + mood_compiled.get('sadness', 0) + mood_compiled.get('disgust', 0)*1.5) / 4
     neutrals = (mood_compiled.get('tentative', 0) + mood_compiled.get('analytical', 0) /2)
     goods = (mood_compiled.get('joy', 0)*1.5 + mood_compiled.get('confident', 0)) / 2
-    swingometer = max(0, min(100, 50 + goods - bads))
+    swingometer = max(0, min(100, (50 + goods - bads) / max(1, (MAX/100))))
     
     JSON_OUT = {
         'relativeMode': True,

-- 
To stop receiving notification emails like this one, please contact
['"commits@kibble.apache.org" <co...@kibble.apache.org>'].