Browse Source

fix a bug

chenhaiyang 1 year ago
parent
commit
7b1f1997a2
1 changed files with 5 additions and 6 deletions
  1. 5 6
      app/services/transfer.py

+ 5 - 6
app/services/transfer.py

@@ -74,9 +74,7 @@ class SpaceInfoService(Service):
     async def get_current_temperature_target(self) -> float:
         targets = await self.get_custom_target()
         if len(targets.get("pre_targets")) > 0:
-            current_targets = targets.get("pre_targets").append(
-                targets.get("normal_targets")
-            )
+            current_targets = pd.concat([targets.get("pre_targets"), targets.get("normal_targets")])
         else:
             current_targets = targets.get("normal_targets")
         temp = (
@@ -120,9 +118,10 @@ class SpaceInfoService(Service):
                 if k != "result":
                     if len(v) > 0:
                         temp = {}
-                        data = np.array(v)
-                        temp.update({"timestamp": data[:, 0]})
-                        temp.update({"value": data[:, 1].astype(np.float)})
+                        time_stamp = [item[0] for item in v]
+                        value = [item[1] for item in v]
+                        temp.update({"timestamp": time_stamp})
+                        temp.update({"value": value})
                         result.update({k: pd.DataFrame(temp)})
                     else:
                         result.update({k: pd.DataFrame()})