From 8b1324139d5c892459eaafac7d041f9a0fe17fc4 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 9 Nov 2023 10:34:08 +0700 Subject: [PATCH] pass time_zone to daily aggs --- tubearchivist/api/src/aggs.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tubearchivist/api/src/aggs.py b/tubearchivist/api/src/aggs.py index b6e1f88..8921d86 100644 --- a/tubearchivist/api/src/aggs.py +++ b/tubearchivist/api/src/aggs.py @@ -2,6 +2,7 @@ from home.src.es.connect import ElasticWrap from home.src.ta.helper import get_duration_str +from home.src.ta.settings import EnvironmentSettings class AggBase: @@ -168,6 +169,7 @@ class DownloadHist(AggBase): "calendar_interval": "day", "format": "yyyy-MM-dd", "order": {"_key": "desc"}, + "time_zone": EnvironmentSettings.TZ, }, "aggs": { "total_videos": {"value_count": {"field": "youtube_id"}}, @@ -175,7 +177,14 @@ class DownloadHist(AggBase): }, } }, - "query": {"range": {"date_downloaded": {"gte": "now-7d/d"}}}, + "query": { + "range": { + "date_downloaded": { + "gte": "now-7d/d", + "time_zone": EnvironmentSettings.TZ, + } + } + }, } def process(self):