From 9c3cf5a534268527aa4c0fa409de79dcc65705ff Mon Sep 17 00:00:00 2001 From: zty Date: Thu, 16 Jan 2025 11:18:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20enm/service=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BC=A0=E5=85=A5=E5=85=AC=E5=BC=8F=EF=BC=8C=E6=A0=A1=E6=AD=A3?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=B5=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/services.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/enm/services.py b/apps/enm/services.py index abf04b35..c5bf7711 100644 --- a/apps/enm/services.py +++ b/apps/enm/services.py @@ -39,7 +39,9 @@ def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour: mpst, _ = MpointStat.objects.get_or_create(mpoint=mpoint, type="hour", year=year, month=month, day=day, hour=hour, defaults={"val": 0}) myLogger.error(f"找不到该测点的时间线数据: {match}, {year}, {month}, {day}, {hour}, 赋予0值") if mpst: - exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val)) + # exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val)) + # 为了校正计算测点 + exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val if mpst.val_correct is None else mpst.val_correct)) try: rval = eval(exp_str2) except Exception as e: