]> git.ipfire.org Git - ipfire.org.git/commitdiff
talk: Show call quality with stars
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Oct 2018 20:58:01 +0000 (21:58 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Oct 2018 20:58:01 +0000 (21:58 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/talk.py
src/templates/talk/index.html
src/templates/talk/modules/cdr.html

index e5c196556c2a2eaf64289b626112efa0e7acf681..9c8b5e913b6c236ca5cce0be3b7738673bfe6690 100644 (file)
@@ -232,6 +232,14 @@ class CDR(object):
        def user_agent(self):
                return self.data.user_agent
 
+       @property
+       def size(self):
+               return sum((self.data.rtp_audio_in_raw_bytes or 0, self.data.rtp_audio_out_raw_bytes or 0))
+
+       @property
+       def mos(self):
+               return self.data.rtp_audio_in_mos
+
 
 class Talk(Object):
        def init(self):
index f692ae6e5b792144b0f2d2c2b13baf48bf39b024..adbd2bb5896bc8aa4292a46e5ed9d3256700f835 100644 (file)
@@ -9,7 +9,7 @@
                <div class="card-body">
                        <h4>{{ _("Your Recent Calls") }}</h4>
 
-                       {% module TalkCDR(current_user, limit=5) %}
+                       {% module TalkCDR(current_user, limit=20) %}
                </div>
        </div>
 {% end block %}
index ce7b854737980e304df01b8bed4034d1421230c2..4e2acc4091c80de426689859c7e1a0186cfaca82 100644 (file)
                                        <br>
 
                                        <span class="small text-muted">
-                                               {{ " - ".join((e for e in (c.codec, c.user_agent) if e)) }}
+                                               {% if c.mos %}
+                                                       {% for i in range(1, 6) %}
+                                                               {% if c.mos > (i + 0.5) %}
+                                                                       <span class="fas fa-star"></span>
+                                                               {% elif c.mos > i %}
+                                                                       <span class="fas fa-star-half-alt"></span>
+                                                               {% else %}
+                                                                       <span class="far fa-star"></span>
+                                                               {% end %}
+                                                       {% end %}
+
+                                                       {{ "%.2f" % c.mos }}/5
+                                               {% end %}
                                        </span>
                                </td>