Commit 32197795 authored by Praibait's avatar Praibait

On renvoie l'heure en timestamp typé JS

parent 1e3f28ff
......@@ -3785,20 +3785,21 @@ def stats_entree_pot(self, idpot):
mini = results[0]
maxi = datetime.datetime(mini.year, mini.month, mini.day, 23, 59)
time = [datetime.datetime(mini.year, mini.month, mini.day, 21)]
while time[-1] <= maxi:
time.append(time[-1] + datetime.timedelta(minutes=1))
tps = [datetime.datetime(mini.year, mini.month, mini.day, 21)]
while tps[-1] <= maxi:
tps.append(tps[-1] + datetime.timedelta(minutes=1))
entrees = [0]
i = 0
for c in range(len(time)):
while i < len(results) and results[i] <= time[c]:
for c in range(len(tps)):
while i < len(results) and results[i] <= tps[c]:
entrees[c] += 1
i += 1
entrees.append(entrees[-1])
entrees = entrees[:-1]
graph = [ [unicode(time[c].time()), entrees[c]] for c in range(len(time)) ]
#On travaille avec des timestamps et on les formates pour convenir aux standards de javascript.
graph = [ [(time.mktime(tps[c].replace(2000,1,1).timetuple())+3600)*1000, entrees[c]] for c in range(len(tps)-1) ]
self._send(graph)
self._debug(4, u"Graphe des entrée du pot {} envoyé".format(idpot))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment