summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/resources
diff options
context:
space:
mode:
authorSerena Feng <feng.xiaowei@zte.com.cn>2017-07-19 09:47:59 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-19 09:47:59 +0000
commit73fce467d6816c3631b9bd8f2543d0f09ff5076a (patch)
tree16a3630dbd574b48ffbd34acf33ec3abd743ee00 /testapi/opnfv_testapi/resources
parent8c50059cf3963b386b6f08606f8ed1d884f27dc7 (diff)
parent39fda4fb3d59b471e4d58e9929969a3c3ccc5387 (diff)
Merge "bugfix: query doesn't work well with period=1"
Diffstat (limited to 'testapi/opnfv_testapi/resources')
-rw-r--r--testapi/opnfv_testapi/resources/result_handlers.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/resources/result_handlers.py b/testapi/opnfv_testapi/resources/result_handlers.py
index 2e15e7a..f9706fc 100644
--- a/testapi/opnfv_testapi/resources/result_handlers.py
+++ b/testapi/opnfv_testapi/resources/result_handlers.py
@@ -60,6 +60,12 @@ class GenericResultHandler(handlers.GenericApiHandler):
query[k] = v
if date_range:
query['start_date'] = date_range
+
+ # if $lt is not provided,
+ # empty/None/null/'' start_date will also be returned
+ if 'start_date' in query and '$lt' not in query['start_date']:
+ query['start_date'].update({'$lt': str(datetime.now())})
+
return query