فهرست منبع

fix: points data

amanda 3 سال پیش
والد
کامیت
47fe910146
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 3 1
      backend_refactor/db/task.py
  2. 2 3
      backend_refactor/service/video_analyzer.py

+ 3 - 1
backend_refactor/db/task.py

@@ -14,11 +14,13 @@ class Task(db.Model):
     status = db.Column(db.Enum('QUEUEING', 'RUNNING', 'FINISHED', 'ERROR'))
     progress = db.Column(db.Integer)
     result = db.Column(db.Text)
+    points = db.Column(db.Text)
 
-    def __init__(self, uuid, type, create_time=time.time() * 1000, status='QUEUEING', progress=0, result='{}'):
+    def __init__(self, uuid, type, create_time=time.time() * 1000, status='QUEUEING', progress=0, result='{}',points='{}'):
         self.uuid = uuid
         self.type = type
         self.create_time = create_time
         self.status = status
         self.progress = progress
         self.result = result
+        self.points = points

+ 2 - 3
backend_refactor/service/video_analyzer.py

@@ -107,12 +107,11 @@ class BaseVideoAnalyzer:
             try:
                 for i in result['data']:
                     result['data'][i]['file'] = FILE_URL + self.video_uuid + "." + result['data'][i]['index'] + ".jpg"
-                result['data']['points'] = self.points
             except Exception as e:
                 logging.warning("file index in data not found, %s" % e)
 
-            print(result['data']['points'])
-            callback("FINISHED", result=result)
+            print(self.points)
+            callback("FINISHED", result={"result": result, "points": self.points})
         except Exception as e:
             callback("ERROR", error=e)
             raise e