文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 64186f40 by 李景熙

在选择了标注的分片后变更任务状态

parent b215b07a
...@@ -158,5 +158,15 @@ def find_slice_annotation_by_task(task_id, type): ...@@ -158,5 +158,15 @@ def find_slice_annotation_by_task(task_id, type):
return list return list
# 通过sliceid查找taskid
def find_task_by_slice(slice_id):
try:
s = Slice.get(Slice.slice_id == slice_id)
except:
return None
else:
return s.task_id
if __name__ == '__main__': if __name__ == '__main__':
Slice.create_table() Slice.create_table()
...@@ -153,6 +153,18 @@ def find_task_name(task_id): ...@@ -153,6 +153,18 @@ def find_task_name(task_id):
return t.task_name return t.task_name
# 修改任务状态
def set_state(task_id, state):
try:
t = Task.get(Task.task_id == task_id)
except:
return False
else:
t.state = state
t.save()
return True
if __name__ == '__main__': if __name__ == '__main__':
# delete_task(10) # delete_task(10)
Task.drop_table() Task.drop_table()
......
import json import json
from flask import Blueprint from flask import Blueprint
from flask import request from flask import request
from Dao import Data, Slice, Relation from Dao import Data, Slice, Relation, Task
slice = Blueprint("slice", __name__, url_prefix="/api/slice") slice = Blueprint("slice", __name__, url_prefix="/api/slice")
...@@ -26,6 +26,8 @@ def select_pieces(): ...@@ -26,6 +26,8 @@ def select_pieces():
data = request.get_json(silent=True) data = request.get_json(silent=True)
userId = int(data['userId']) userId = int(data['userId'])
selected = list(data['selected']) selected = list(data['selected'])
task_id = Slice.find_task_by_slice(selected[0])
Task.set_state(task_id, 1)
for sliceItem in selected: for sliceItem in selected:
ret = Data.find_data_by_slice(sliceItem) ret = Data.find_data_by_slice(sliceItem)
if ret.code == 0: if ret.code == 0:
......
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