From 3ea89c331618aaac8c52aa021728512818ac06c9 Mon Sep 17 00:00:00 2001 From: Arvind Date: Fri, 24 Jan 2014 16:05:23 +0530 Subject: [PATCH] Contenders for least active hours are now added to the report. --- query.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/query.py b/query.py index 98bc65a..41dca02 100644 --- a/query.py +++ b/query.py @@ -70,5 +70,8 @@ class Query: 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)} -- 1.7.10.4