Commit d2c161bf authored by lcn's avatar lcn

bug修复

parent 4c7a3d80
...@@ -20,8 +20,7 @@ from unify_api.modules.electric.procedures.electric_util import \ ...@@ -20,8 +20,7 @@ from unify_api.modules.electric.procedures.electric_util import \
load_point_ctnum load_point_ctnum
from datetime import datetime from datetime import datetime
from unify_api.constants import REAL_EXP_TIME from unify_api.constants import REAL_EXP_TIME
from unify_api.utils.time_format import CST, YMD_Hms, timestamp2dts, \ from unify_api.utils.time_format import CST, YMD_Hms, timestamp2dts
time_pick_transf
from unify_api.modules.common.procedures.location_temp_rcurrent import \ from unify_api.modules.common.procedures.location_temp_rcurrent import \
location_stats_statics location_stats_statics
from unify_api.modules.electric.components.electric import ( from unify_api.modules.electric.components.electric import (
...@@ -347,14 +346,12 @@ async def elec_index_service(cid, point_id, start, end): ...@@ -347,14 +346,12 @@ async def elec_index_service(cid, point_id, start, end):
ctnum = await load_point_ctnum(point_id) ctnum = await load_point_ctnum(point_id)
ctnum = ctnum if ctnum == 2 else 3 ctnum = ctnum if ctnum == 2 else 3
now = str(datetime.now()) now = str(datetime.now())
intervel, _ = time_pick_transf(start, end) if start[:10] == now[:10] and end[:10] == now[:10]:
if intervel == 86400:
table_name = "point_1day_electric"
redi_table_name = "location_1day_aiao"
else:
table_name = "point_15min_electric" table_name = "point_15min_electric"
redi_table_name = "location_15min_aiao" redi_table_name = "location_15min_aiao"
else:
table_name = "point_1day_electric"
redi_table_name = "location_1day_aiao"
if ctnum == 2: if ctnum == 2:
common_items = ["lf_mean", "lf_min", "lf_max", "pttl_mean", "pttl_min", common_items = ["lf_mean", "lf_min", "lf_max", "pttl_mean", "pttl_min",
"pttl_max", "qttl_mean", "qttl_min", "qttl_max", "pttl_max", "qttl_mean", "qttl_min", "qttl_max",
...@@ -463,7 +460,7 @@ async def elec_index_service(cid, point_id, start, end): ...@@ -463,7 +460,7 @@ async def elec_index_service(cid, point_id, start, end):
mean_item_name = f"{item}_mean" mean_item_name = f"{item}_mean"
avg_value = df[mean_item_name].mean() avg_value = df[mean_item_name].mean()
if not pd.isna(avg_value): if not pd.isna(avg_value):
avg_value = round(avg_value, 2) if avg_value else "" avg_value = round(avg_value, 4) if avg_value else ""
else: else:
avg_value = "" avg_value = ""
elec_index = ElecIndex( elec_index = ElecIndex(
......
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