From 2c8a86d6f5d5e9da13d513124e1a0414def61a74 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 15 Aug 2023 15:49:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20if=20hour=E6=94=B9=E4=B8=BAif=20hour=20i?= =?UTF-8?q?s=20not=20None?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index fc0a1731..dace7337 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -141,7 +141,7 @@ def cal_mpointstats(is_now=1, year=None, month=None, day=None, hour=None): """ 计算所有自动采集测点的统计值,默认当前小时, 可手动传入时间 """ - if year and month and day and hour: + if year and month and day and hour is not None: pass else: now, pre = get_current_and_previous_time() @@ -235,7 +235,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, mgroup = Mgroup.objects.get(id=mgroupId) if sflogId: sflog = SfLog.objects.get(id=sflogId) - elif year and month and day and hour: + elif year and month and day and hour is not None: mytz = tz.gettz(settings.TIME_ZONE) dt = datetime.datetime(year=year, month=month, day=day, hour=hour, tzinfo=mytz) sflog = SfLog.objects.get(start_time__lt=dt, end_time__gte=dt, mgroup=mgroup)