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

Commit 87ee539c by 李景熙

修改创建标注关系功能

parent 42813969
......@@ -32,7 +32,7 @@ class Relation(Model):
# 创建标注关系
def create_relation(slice_id, user_id, data_id):
try:
Slice.add_file(slice_id)
Slice.add_annotation(slice_id)
relation = Relation(slice_id=slice_id, user_id=user_id, data_id=data_id)
relation.save()
except:
......@@ -41,28 +41,6 @@ def create_relation(slice_id, user_id, data_id):
return Result(1, "create success", {})
# 根据用户id找寻标注关系
def find_relationbyuserid(user_id):
try:
p = Relation.get(Relation.user_id == user_id)
except Exception:
return Result(0, "find failed", {})
else:
return Result(1, "find success", p.email)
# 根据数据id找标注关系
def find_relationbydataid(data_id):
if not Relation.table_exists():
Relation.create_table()
try:
p = Relation.get(Relation.data_id == data_id)
except Exception:
return Result(0, "find failed", {})
else:
return Result(1, "find success", p.email)
if __name__ == '__main__':
Relation.create_table()
# create_relation(3, 1, 2)
......@@ -74,7 +74,7 @@ def delete_slice_by_task(task_id):
return Result(1, "delete success", {})
# 查找某任务下的分片
# 查找某任务下的分片(用于在分片列表中显示)
def find_slice_by_task(task_id):
try:
find = Slice.select(Slice.slice_id, Slice.document_number, Slice.type, Slice.model_id, Slice.illustration).where(
......@@ -118,7 +118,7 @@ def add_file(slice_id):
return True
# 添加文件
# 添加标注关系
def add_annotation(slice_id):
try:
s = Slice.get(Slice.slice_id == slice_id)
......@@ -130,7 +130,7 @@ def add_annotation(slice_id):
return True
# 查找任务下的分片id及描述
# 查找任务下的分片id及描述(用于修改任务时的返回)
def find_slice_annotation_by_task(task_id, type):
try:
find = Slice.select(Slice.slice_id, Slice.type, Slice.model_id,
......
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