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

Commit 18ba6e9a by 李景熙

修复选择分片的bug

parent 64186f40
......@@ -66,7 +66,6 @@ def find_data_by_slice(slice_id):
'name': find[index].name,
'size': find[index].size,
'url': find[index].url,
'state': 0
}
)
index += 1
......@@ -99,13 +98,6 @@ def find_url_by_slice(slice_id):
# 删除某分片下的文件
def delete_data_by_slice(slice_id):
try:
find = Data.select(Data.url).where(Data.slice_id == slice_id)
index = 0
while index < len(find):
file_dir = os.path.join(basedir, UPLOAD_FOLDER, find[index].url)
if os.path.exists(file_dir):
os.remove(file_dir)
index += 1
Data.delete().where(Data.slice_id == slice_id).execute()
except:
return Result(0, "delete failed", {})
......@@ -114,4 +106,5 @@ def delete_data_by_slice(slice_id):
if __name__ == '__main__':
delete_data_by_slice(10)
\ No newline at end of file
Data.drop_table()
Data.create_table()
\ No newline at end of file
......@@ -42,5 +42,6 @@ def create_relation(slice_id, user_id, data_id):
if __name__ == '__main__':
Relation.drop_table()
Relation.create_table()
# create_relation(3, 1, 2)
......@@ -20,7 +20,7 @@ class Slice(Model):
task_id = IntegerField(null=False)
model_id = CharField(null=True)
illustration = TextField(null=True)
Annotaion_number = IntegerField(null=False, default=0)
Annotation_number = IntegerField(null=False, default=0)
document_number = IntegerField(null=False, default=0)
type = FixedCharField(null=0)
......@@ -169,4 +169,5 @@ def find_task_by_slice(slice_id):
if __name__ == '__main__':
Slice.drop_table()
Slice.create_table()
......@@ -160,7 +160,7 @@ def set_state(task_id, state):
except:
return False
else:
t.state = state
t.task_state = state
t.save()
return True
......
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