config test

This commit is contained in:
David 2022-12-26 00:32:34 +01:00
parent 18d77192df
commit af829e8711

View File

@ -12,8 +12,8 @@ import sqlite3
# Constantes # Constantes
STAT_DIR = '/srv/visio.chapril.org/statistiques/' 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_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', ] 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_MAX_FIELDS = ['largest_conference',]
STATS_FR_MAX_FIELDS = ['plus grande conference',] STATS_FR_MAX_FIELDS = ['plus grande conference',]
dbPath = '/srv/visio.chapril.org/statistiques/stats_sqlite.db' dbPath = '/srv/visio.chapril.org/statistiques/stats_sqlite.db'
@ -112,7 +112,7 @@ class Stats:
if 'seconds' in k: if 'seconds' in k:
(v,u) = self.__conv(consolided[k],dataType='t') (v,u) = self.__conv(consolided[k],dataType='t')
consolided.pop(k) consolided.pop(k)
n_k = k.replace('_seconds','') n_k = k.replace('_seconds','_time')
consolided[n_k] = f"{v} {u}" consolided[n_k] = f"{v} {u}"
if moy_conf_by_day > 1: if moy_conf_by_day > 1:
@ -191,6 +191,7 @@ def runMain():
stats = Stats(year,mois) stats = Stats(year,mois)
res = stats.parse() res = stats.parse()
print(res)
for (k,v) in res.items(): for (k,v) in res.items():
i = STATS_TOT_FIELDS.index(k) i = STATS_TOT_FIELDS.index(k)
fr = STATS_FR_TOT_FIELDS[i] fr = STATS_FR_TOT_FIELDS[i]
@ -202,13 +203,10 @@ def runMain():
print(f"Moyenne participants par conference={moyenne_part}") print(f"Moyenne participants par conference={moyenne_part}")
except: except:
pass pass
try: moyenne_duree = float(res['total_conference_time'].split()[0]) * 60 / int(res['total_conferences_completed'])
moyenne_duree = int(res['total_conference_seconds'].split()[0] * 60) / int(res['total_conferences_completed']) moyenne_duree = int((moyenne_duree + 0.5) * 10) / 10
moyenne_duree = int((moyenne_part + 0.5) * 10) / 10
print(f"duree moyenne des conferences={moyenne_duree}") print(f"duree moyenne des conferences={moyenne_duree} min")
except:
pass
if __name__ == '__main__': if __name__ == '__main__':
runMain() runMain()