fix: prevent out of bound time span. (Happend because the hole day is

considered, 24*7 < 7days + remaining hours of the day)
pull/8/head
Sami Mokaddem 2017-11-21 09:26:58 +01:00
parent 57abda40c7
commit e4c5cea55a
1 changed files with 4 additions and 1 deletions

View File

@ -146,7 +146,10 @@ class Users_helper:
for timestamp in timestamps: # sum occurence during the current hour
dateTimestamp = datetime.datetime.fromtimestamp(float(timestamp))
dateTimestamp = dateTimestamp.replace(minute=0, second=0, microsecond=0)
dico_hours[util.getTimestamp(dateTimestamp)] += 1
try:
dico_hours[util.getTimestamp(dateTimestamp)] += 1
except KeyError: # timestamp out of bound (greater than 1 week)
pass
# Format data
data = []