config test

This commit is contained in:
David 2022-12-20 09:23:15 +01:00
parent d3c5974145
commit 10cfc283be

View File

@ -84,6 +84,7 @@ class Stats:
def parse(self):
res = self.db.dbQuery(f"""SELECT * FROM {dbName} WHERE timestamp > {self.startDate} AND timestamp < {self.endDate} ORDER by id""")
consolided = {}
moy_conf_by_day = 0
for line in res:
field = line[2]
if field in STATS_TOT_FIELDS:
@ -91,6 +92,9 @@ class Stats:
consolided[field] = consolided[field] + int(line[3])
else:
consolided[field] = int(line[3])
if field == 'conferences':
moy_conf_by_day += 1
if field in STATS_MAX_FIELDS:
if field in consolided:
if consolided[field] < int(line[3]):
@ -105,6 +109,12 @@ class Stats:
n_k = k.replace('_seconds','')
consolided[n_k] = f"{v} {u}"
if moy_conf_by_day > 1:
tot = consolided['conferences']
moy = int(tot/moy_conf_by_day)
consolided.pop('conferences')
consolided['conferences by day'] = moy
return consolided