From af829e8711d472c1b5daefd9e31b5e315ef69c44 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 26 Dec 2022 00:32:34 +0100 Subject: [PATCH] config test --- statistiques/parseStats.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/statistiques/parseStats.py b/statistiques/parseStats.py index febc622..17a564e 100755 --- a/statistiques/parseStats.py +++ b/statistiques/parseStats.py @@ -12,8 +12,8 @@ import sqlite3 # Constantes STAT_DIR = '/srv/visio.chapril.org/statistiques/' -STATS_TOT_FIELDS = ['total_conferences_created','total_failed_conferences','total_conferences_completed','total_conference_seconds','total_bytes_received','total_bytes_sent','total_participants','conferences','videochannels','endpoints_sending_audio', 'total_conference', 'average conferences by day', ] -STATS_FR_TOT_FIELDS = ['conferences creees total','conferences totalement echouees','conferences terminees total','duree totale conferences','total octets reçus','total octets envoyés','total participants','nombre de conferences','canaux video','canaux audio', 'Conferences total', 'moyenne de conferences par jour', ] +STATS_TOT_FIELDS = ['total_conferences_created','total_failed_conferences','total_conferences_completed','total_conference_seconds','total_bytes_received','total_bytes_sent','total_participants','conferences','videochannels','endpoints_sending_audio', 'total_conference', 'average conferences by day', 'total_conference_time', ] +STATS_FR_TOT_FIELDS = ['conferences creees total','conferences totalement echouees','conferences terminees total','duree totale conferences','total octets reçus','total octets envoyés','total participants','nombre de conferences','canaux video','canaux audio', 'Conferences total', 'moyenne de conferences par jour', 'duree totale conferences', ] STATS_MAX_FIELDS = ['largest_conference',] STATS_FR_MAX_FIELDS = ['plus grande conference',] dbPath = '/srv/visio.chapril.org/statistiques/stats_sqlite.db' @@ -112,7 +112,7 @@ class Stats: if 'seconds' in k: (v,u) = self.__conv(consolided[k],dataType='t') consolided.pop(k) - n_k = k.replace('_seconds','') + n_k = k.replace('_seconds','_time') consolided[n_k] = f"{v} {u}" if moy_conf_by_day > 1: @@ -191,6 +191,7 @@ def runMain(): stats = Stats(year,mois) res = stats.parse() + print(res) for (k,v) in res.items(): i = STATS_TOT_FIELDS.index(k) fr = STATS_FR_TOT_FIELDS[i] @@ -202,13 +203,10 @@ def runMain(): print(f"Moyenne participants par conference={moyenne_part}") except: pass - try: - moyenne_duree = int(res['total_conference_seconds'].split()[0] * 60) / int(res['total_conferences_completed']) - moyenne_duree = int((moyenne_part + 0.5) * 10) / 10 + moyenne_duree = float(res['total_conference_time'].split()[0]) * 60 / int(res['total_conferences_completed']) + moyenne_duree = int((moyenne_duree + 0.5) * 10) / 10 - print(f"duree moyenne des conferences={moyenne_duree}") - except: - pass + print(f"duree moyenne des conferences={moyenne_duree} min") if __name__ == '__main__': runMain()