diff --git a/statistiques/parseStats.py b/statistiques/parseStats.py index f2d01df..b0146f6 100755 --- a/statistiques/parseStats.py +++ b/statistiques/parseStats.py @@ -8,6 +8,7 @@ import time import datetime from calendar import monthrange import sqlite3 +import numpy as np # Constantes STAT_DIR = '/srv/visio.chapril.org/statistiques/' @@ -84,7 +85,11 @@ class Stats: def parse(self): tot_part_start = tot_part_end = 0 tot_part_start = self.db.dbQuery(f"""SELECT value_field FROM {dbName} WHERE timestamp = {self.startDate} AND key_field = 'total_participants'""")[-1][0] - tot_part_end = self.db.dbQuery(f"""SELECT value_field FROM {dbName} WHERE timestamp < {self.endDate} AND key_field = 'total_participants'""")[-1][0] + tot_part_end = self.db.dbQuery(f"""SELECT value_field FROM {dbName} WHERE timestamp > 'self.startDae= AND timestamp < {self.endDate} AND key_field = 'total_participants'""") + max_tot = [] + for mx in tot_part_end: + max_tot.append(int(mx[0])) + tot_part_end = np.max(max_tot) tot_part = int(tot_part_end) - int(tot_part_start) print(tot_part)