Commit 3e61f540 authored by ZZH's avatar ZZH

fix alarm records 2024-06-04

parent 8702e1bf
...@@ -245,6 +245,9 @@ async def wx_list_alarm_zdu_service(cid, point_list, start, end): ...@@ -245,6 +245,9 @@ async def wx_list_alarm_zdu_service(cid, point_list, start, end):
async def pack_alarm_records(records, pid, lang): async def pack_alarm_records(records, pid, lang):
if not records:
return []
alarm_recs, mtr_names = [], {} alarm_recs, mtr_names = [], {}
if lang != "zh_CN": if lang != "zh_CN":
mtids = [r["mtid"] for r in records] mtids = [r["mtid"] for r in records]
...@@ -328,6 +331,9 @@ async def list_alarm_service(cid, user_id, point_id, start, end, importance, ...@@ -328,6 +331,9 @@ async def list_alarm_service(cid, user_id, point_id, start, end, importance,
conds_str = " AND ".join(["point_1min_event." + i for i in conds]) conds_str = " AND ".join(["point_1min_event." + i for i in conds])
alarm_lst = await get_list_alarm_dao(conds_str, page_size, page_num) alarm_lst = await get_list_alarm_dao(conds_str, page_size, page_num)
if not alarm_lst:
return ListAlarmResponse(total=0, rows=[])
lang = await load_user_lang(user_id) lang = await load_user_lang(user_id)
alarm_records = await pack_alarm_records(alarm_lst, point_id, lang) alarm_records = await pack_alarm_records(alarm_lst, point_id, lang)
return ListAlarmResponse(total=total, rows=alarm_records) return ListAlarmResponse(total=total, rows=alarm_records)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment