mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
refactor(plugins): BigNumber Time Comparison with existing time_offset API (#27718)
Co-authored-by: lilykuang <jialikuang@gmail.com> Co-authored-by: Kamil Gabryjelski <kamil.gabryjelski@gmail.com>
This commit is contained in:
@@ -46,6 +46,7 @@ get_time_range_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeRange": {"type": "string"},
|
||||
"shift": {"type": "string"},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -110,12 +111,16 @@ class Api(BaseSupersetView):
|
||||
|
||||
rv = []
|
||||
for time_range in time_ranges:
|
||||
since, until = get_since_until(time_range["timeRange"])
|
||||
since, until = get_since_until(
|
||||
time_range=time_range["timeRange"],
|
||||
time_shift=time_range.get("shift"),
|
||||
)
|
||||
rv.append(
|
||||
{
|
||||
"since": since.isoformat() if since else "",
|
||||
"until": until.isoformat() if until else "",
|
||||
"timeRange": time_range["timeRange"],
|
||||
"shift": time_range.get("shift"),
|
||||
}
|
||||
)
|
||||
return self.json_response({"result": rv})
|
||||
|
||||
Reference in New Issue
Block a user