Commit 042ec0e5 authored by lcn's avatar lcn

bug修复

parent 0c29e639
...@@ -85,15 +85,16 @@ async def electric_use_info(cid): ...@@ -85,15 +85,16 @@ async def electric_use_info(cid):
'overResidualCurrent', 'unbalanceU', 'overI'] 'overResidualCurrent', 'unbalanceU', 'overI']
score_sql = f"select importance, count(importance) doc_count from " \ score_sql = f"select importance, count(importance) doc_count from " \
f"point_1min_event where cid=%s and event_datetime BETWEEN" \ f"point_1min_event where cid=%s and event_datetime BETWEEN" \
f"'{start}' and '{now}' GROUP BY importance" f"'{start}' and '{now}' and event_type in %s " \
f"GROUP BY importance"
alarm_sql = f"select importance, count(importance) doc_count from " \ alarm_sql = f"select importance, count(importance) doc_count from " \
f"point_1min_event where cid=%s and event_datetime BETWEEN" \ f"point_1min_event where cid=%s and event_datetime BETWEEN" \
f"'{start}' and '{now}' and event_type in %s " \ f"'{start}' and '{now}' " \
f"GROUP BY importance" f"GROUP BY importance"
first_score, second_score, third_score = 0, 0, 0 first_score, second_score, third_score = 0, 0, 0
async with MysqlUtil() as conn: async with MysqlUtil() as conn:
score_datas = await conn.fetchall(score_sql, args=(cid,)) score_datas = await conn.fetchall(score_sql, args=(cid, score_events))
alarm_datas = await conn.fetchall(alarm_sql, args=(cid, score_events)) alarm_datas = await conn.fetchall(alarm_sql, args=(cid,))
for data in score_datas: for data in score_datas:
if data["importance"] == Importance.First.value: if data["importance"] == Importance.First.value:
first_score += data["doc_count"] first_score += data["doc_count"]
......
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