Use yesterday as T-1
This commit is contained in:
@@ -80,12 +80,13 @@ except Exception:
|
|||||||
timezone_name = "UTC"
|
timezone_name = "UTC"
|
||||||
|
|
||||||
now = datetime.now(tz)
|
now = datetime.now(tz)
|
||||||
today = now.date()
|
# Use the last completed calendar day as the anchor: T-1 is always yesterday.
|
||||||
# T-5 through T-1. The end boundary is today because Superset treats it as the
|
# All query windows below therefore exclude today's incomplete data.
|
||||||
# exclusive business-day boundary for this chart's shifted time dimension.
|
today = now.date() - timedelta(days=1)
|
||||||
|
# T-5 through T-1, where the chart's shifted `dt` values are the five labels
|
||||||
|
# from five days before today through yesterday.
|
||||||
start_date = today - timedelta(days=5)
|
start_date = today - timedelta(days=5)
|
||||||
time_range = f"{start_date.isoformat()} : {today.isoformat()}"
|
time_range = f"{start_date.isoformat()} : {today.isoformat()}"
|
||||||
# The chart's shifted `dt` values label the five returned business days.
|
|
||||||
requested_dates = [
|
requested_dates = [
|
||||||
(today - timedelta(days=offset)).isoformat() for offset in range(4, -1, -1)
|
(today - timedelta(days=offset)).isoformat() for offset in range(4, -1, -1)
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user