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

Commit 1a151b8c by 李景熙

在Relation中添加标注结果id属性并增加修改函数

parent 5a8d9326
...@@ -20,6 +20,7 @@ class Relation(Model): ...@@ -20,6 +20,7 @@ class Relation(Model):
slice_id = IntegerField(null=False) slice_id = IntegerField(null=False)
user_id = IntegerField(null=False) user_id = IntegerField(null=False)
data_id = IntegerField(null=False) data_id = IntegerField(null=False)
result_id = IntegerField()
flag = BooleanField(default=False) # 代表该标注关系是否被标注 flag = BooleanField(default=False) # 代表该标注关系是否被标注
score = IntegerField(default=0) score = IntegerField(default=0)
receive_time = DateTimeField(default=datetime.datetime.now()) receive_time = DateTimeField(default=datetime.datetime.now())
...@@ -50,8 +51,18 @@ def find_slice_by_executor(user_id): ...@@ -50,8 +51,18 @@ def find_slice_by_executor(user_id):
return slice_list return slice_list
def set_result_id(userid, dataid, resultid):
try:
relation = Relation.get(Relation.user_id == userid, Relation.data_id == dataid)
relation.result_id = resultid
relation.save()
except:
return False
else:
return True
if __name__ == '__main__': if __name__ == '__main__':
# Relation.drop_table() Relation.drop_table()
# Relation.create_table() Relation.create_table()
print(find_slice_by_executor(1))
# create_relation(3, 1, 2) # create_relation(3, 1, 2)
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