Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaonan
unify_api2
Commits
3e61f540
Commit
3e61f540
authored
Jun 04, 2024
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix alarm records 2024-06-04
parent
8702e1bf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
list_alarm_service.py
...y_api/modules/alarm_manager/service/list_alarm_service.py
+6
-0
No files found.
unify_api/modules/alarm_manager/service/list_alarm_service.py
View file @
3e61f540
...
@@ -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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment