|
@@ -100,11 +100,14 @@ class SpaceInfoService(Service):
|
|
|
|
|
|
try:
|
|
|
pre_target_df = pd.DataFrame(raw_info.get('perTargets'))
|
|
|
- normal_target_df = pd.DataFrame(raw_info.get('normalTargets'))
|
|
|
pre_target_df.set_index('time', inplace=True)
|
|
|
- normal_target_df.set_index('time', inplace=True)
|
|
|
except KeyError:
|
|
|
pre_target_df = pd.DataFrame()
|
|
|
+
|
|
|
+ try:
|
|
|
+ normal_target_df = pd.DataFrame(raw_info.get('normalTargets'))
|
|
|
+ normal_target_df.set_index('time', inplace=True)
|
|
|
+ except KeyError:
|
|
|
normal_target_df = pd.DataFrame()
|
|
|
|
|
|
return {
|
|
@@ -203,7 +206,7 @@ class Duoduo(Service):
|
|
|
|
|
|
return Season(raw_info.get('data'))
|
|
|
|
|
|
- async def get_fill_rate(self):
|
|
|
+ async def get_fill_count(self) -> Dict:
|
|
|
url = self._base_url.join('duoduo-service/review-service/space/report/quarter/query')
|
|
|
payload = {
|
|
|
'criteria': {
|
|
@@ -221,14 +224,13 @@ class Duoduo(Service):
|
|
|
}
|
|
|
|
|
|
raw_info = await self._post(url, payload=payload)
|
|
|
+
|
|
|
try:
|
|
|
- content = raw_info.get('content')[-1]
|
|
|
- hot_rate = (content.get('hotNum')
|
|
|
- / (content.get('normalNum') + content.get('hotNum') + content.get('coldNum')))
|
|
|
- except KeyError and ZeroDivisionError:
|
|
|
- hot_rate = 0.0
|
|
|
+ result = raw_info.get('content')[-1]
|
|
|
+ except IndexError:
|
|
|
+ result = {}
|
|
|
|
|
|
- return hot_rate
|
|
|
+ return result
|
|
|
|
|
|
async def get_space_by_equipment(self, equipment_id: str) -> List[dict]:
|
|
|
url = self._base_url.join('duoduo-service/object-service/object/space/findForServe')
|