From 75b2a420b7c4f3443722e612be195453d9b697f8 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 3 Dec 2025 16:16:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20translate=5Feval=5Fformula=20=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E6=8A=A5=E9=94=99=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/services.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/enm/services.py b/apps/enm/services.py index 77399bc7..827e01d5 100644 --- a/apps/enm/services.py +++ b/apps/enm/services.py @@ -35,7 +35,11 @@ def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour: for match in matches: mpst = MpointStat.objects.filter(mpoint__code=match, type="hour", year=year, month=month, day=day, hour=hour).first() if mpst is None: - mpoint = Mpoint.objects.get(code=match) + try: + mpoint = Mpoint.objects.get(code=match) + except Exception as e: + myLogger.error(f"找不到该测点: exp_str: {exp_str} code: {match} {e}") + raise 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: