Add relative start param for time filters (#7525)

* Add relative start param for time filters

* Fix typo and add types to parse_human_datetime

* Add relative start/end to query_object

* Fix linting error
This commit is contained in:
Ville Brofeldt
2019-05-31 16:55:26 +03:00
committed by GitHub
parent dbdb6b093a
commit c1712e5d10
5 changed files with 50 additions and 17 deletions

View File

@@ -51,9 +51,16 @@ class QueryObject:
is_prequery: bool = False,
columns: List[str] = None,
orderby: List[List] = None,
relative_start: str = app.config.get('DEFAULT_RELATIVE_START_TIME', 'today'),
relative_end: str = app.config.get('DEFAULT_RELATIVE_END_TIME', 'today'),
):
self.granularity = granularity
self.from_dttm, self.to_dttm = utils.get_since_until(time_range, time_shift)
self.from_dttm, self.to_dttm = utils.get_since_until(
relative_start=relative_start,
relative_end=relative_end,
time_range=time_range,
time_shift=time_shift,
)
self.is_timeseries = is_timeseries
self.time_range = time_range
self.time_shift = utils.parse_human_timedelta(time_shift)