feat: 修改drain2serializer返回数据
This commit is contained in:
parent
44c4a34c69
commit
7f93c453e6
|
@ -36,7 +36,8 @@ class Drain2Serializer(CustomModelSerializer):
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
today = str(now)[:10]+' 00:00:00'
|
today = str(now)[:10]+' 00:00:00'
|
||||||
today_last = str(now)[:10]+' 23:59:59'
|
today_last = str(now)[:10]+' 23:59:59'
|
||||||
odata = equips.values('id', 'name', 'type')
|
odata = equips.values('id', 'name', 'type',
|
||||||
|
'is_online', 'running_state')
|
||||||
eids = [f"'{e['id']}'" for e in odata]
|
eids = [f"'{e['id']}'" for e in odata]
|
||||||
eids_str = ','.join(eids)
|
eids_str = ','.join(eids)
|
||||||
sql_str = f'''
|
sql_str = f'''
|
||||||
|
@ -94,10 +95,10 @@ GROUP BY
|
||||||
for i in odata:
|
for i in odata:
|
||||||
i.update(data.get(i['id'], {
|
i.update(data.get(i['id'], {
|
||||||
"avg_tsp": None,
|
"avg_tsp": None,
|
||||||
"total_duration_online": None,
|
"total_duration_online": 0,
|
||||||
"total_duration_run": None,
|
"total_duration_run": 0,
|
||||||
"total_duration_standby": None,
|
"total_duration_standby": 0,
|
||||||
"last_running_state": None,
|
"last_running_state": 50,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return odata
|
return odata
|
||||||
|
|
Loading…
Reference in New Issue