config test

This commit is contained in:
David 2023-01-04 13:38:32 +01:00
parent f82ec7a80e
commit 4c3f8a8eef

View File

@ -82,14 +82,12 @@ class Stats:
return octets,unit
def parse(self):
res = None
while res is None:
tot_part_start = tot_part_end = 0
res = self.db.dbQuery(f"""SELECT value_field FROM {dbName} WHERE timestamp = {self.startDate} AND key_field = 'total_participants' ORDER by id""")
print(res)
res = self.db.dbQuery(f"""SELECT value_field FROM {dbName} WHERE timestamp = {self.endDate} AND key_field = 'total_participants' ORDER by id""")
print(res)
res = self.db.dbQuery(f"""SELECT * FROM {dbName} WHERE timestamp > {self.startDate} AND timestamp < {self.endDate} ORDER by id""")
if res is None:
time.sleep(60)
#if res is None:
# sys.exit('Traitement en cours, base de données indisponible')
consolided = {}
moy_conf_by_day = 0
for line in res:
@ -158,6 +156,8 @@ class SQLite:
self.conn.close()
def dbQuery(self,query='SELECT'):
rows = None
while rows is None:
try:
self.__openDb()
self.cursor.execute(query)
@ -165,6 +165,8 @@ class SQLite:
self.__closeDb()
except sqlite3.OperationalError:
rows = None
time.sleep(30)
return rows
def dbInsert(self,ts,k,v):