fix: was setting time span of elements the day before instead of the

real one.
update: set window size of timeline to cover the selected dates.
pull/29/head
Sami Mokaddem 2017-12-11 15:42:25 +01:00
parent a47ec1da52
commit eec59473d6
2 changed files with 5 additions and 4 deletions

View File

@ -192,13 +192,13 @@ class Trendings_helper:
to_ret = [] to_ret = []
ONEDAY = 60*60*24 ONEDAY = 60*60*24
for item, timestamps in dico_items.items(): for item, timestamps in dico_items.items():
obj = {'name': item, 'start': timestamps[0]-ONEDAY, 'end': timestamps[0]} obj = {'name': item, 'start': timestamps[0], 'end': timestamps[0]+ONEDAY}
for t in timestamps: for t in timestamps:
if t-obj['end'] > ONEDAY: #new entry if t-obj['end'] > ONEDAY: #new entry
to_ret.append(copy.deepcopy(obj)) to_ret.append(copy.deepcopy(obj))
obj['start'] = t-ONEDAY obj['start'] = t
obj['end'] = t obj['end'] = t+ONEDAY
else: # contrinue entry else: # contrinue entry
obj['end'] = t obj['end'] = t+ONEDAY
to_ret.append(obj) to_ret.append(obj)
return to_ret return to_ret

View File

@ -447,6 +447,7 @@ function updateTimeline() {
} }
timeline.setGroups(groups); timeline.setGroups(groups);
timeline.setItems(items); timeline.setItems(items);
timeline.setWindow(dateStart, dateEnd);
}); });
} }