From 924c5d09b1cd730308d726e9ec19a45368425017 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 16 May 2024 12:34:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=A1=E7=AE=97month=5Fst=E6=97=B6?= =?UTF-8?q?=E5=BF=85=E9=A1=BB=E6=9C=89sflog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index f978b398..4b3eaaba 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -365,6 +365,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, mytz = tz.gettz(settings.TIME_ZONE) dt = datetime.datetime(year=year, month=month, day=day, hour=hour, tzinfo=mytz) sflog = get_sflog(mgroup, dt) + team = None if sflog: year_s, month_s, day_s = sflog.get_ymd team = sflog.team @@ -387,7 +388,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, enstat, _ = EnStat.objects.get_or_create( type="day_s", mgroup=mgroup, year_s=year_s, month_s=month_s, day_s=day_s, defaults={"type": "day_s", "mgroup": mgroup, "year_s": year_s, "month_s": month_s, "day_s": day_s} ) - elif type == "month_st": + elif type == "month_st" and team: enstat, _ = EnStat.objects.get_or_create( type="month_st", mgroup=mgroup, team=team, year_s=year_s, month_s=month_s, defaults={"type": "month_st", "mgroup": mgroup, "year_s": year_s, "month_s": month_s, "team": team} )