--- a/query.py +++ b/query.py @@ -70,6 +70,9 @@ slots['{0}-{1}'.format(date1.strftime('%H'), date2.strftime('%H'))] = result.filter(self.t.lt.calldate.between(date1, date2)).count() maxLoad = max(slots, key = lambda x: slots.get(x) ) - minLoad = min(slots, key = lambda x: slots.get(x) ) - return {"maxLoad": maxLoad, "maxCalls": slots[maxLoad], "minLoad": minLoad} + minLoad = [] + for slot in slots: + if min(slots, slots[slot]) == 0: + minLoad.append(slot) + return {"maxLoad": maxLoad, "maxCalls": slots[maxLoad], "minLoad": repr(minLoad)}