From 10cfc283bed9cc4f4f7c8a66dc4fbc39cda19400 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 20 Dec 2022 09:23:15 +0100 Subject: [PATCH] config test --- statistiques/parseStats_ng.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/statistiques/parseStats_ng.py b/statistiques/parseStats_ng.py index 606e2fc..c31bc2c 100755 --- a/statistiques/parseStats_ng.py +++ b/statistiques/parseStats_ng.py @@ -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