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

Commit 693f3927 by 李景熙

修改审核界面中的进度显示问题

parent 78bb1298
......@@ -5,6 +5,10 @@ from dao import Slice, Task, User
class Result:
code: int
message: []
data: {}
def __init__(self, code, message, data):
self.code = code
self.message = message
......@@ -40,10 +44,11 @@ def create_relation(slice_id, user_id, data_id):
# 设置标注关系的打分数值
def set_grade(user_id, data_id, score):
def set_grade(user_id, slice_id, score):
try:
relation = Relation.get(Relation.user_id == user_id, Relation.data_id == data_id)
relation = Relation.get(Relation.user_id == user_id, Relation.slice_id == slice_id)
relation.score = score
relation.flag2 = True
relation.save()
except:
return Result(0, "grade failed", {})
......@@ -120,6 +125,7 @@ def get_completed_num(sliceId):
else:
return num
# 获取某用户,某分片的标注进度
def get_flag_count(userId, sliceId):
try:
......@@ -164,7 +170,7 @@ def get_state(user_id, data_id):
# 获取某文件的标注者信息
def get_executors(data_id):
try:
find = Relation.select(Relation.user_id, Relation.relation_id).where(Relation.data_id == data_id, Relation.flag == 1, Relation.flag2 == 0)
find = Relation.select(Relation.user_id, Relation.relation_id).where(Relation.data_id == data_id)
index = 0
list = []
while index < len(find):
......@@ -193,8 +199,7 @@ def get_relation_id(uid, did):
if __name__ == '__main__':
# Relation.drop_table()
# Relation.create_table()
print(get_executors(4).data)
Relation.drop_table()
Relation.create_table()
# print(get_state(1, 5))
# create_relation(3, 1, 2)
......@@ -17,7 +17,7 @@ def get_tasks():
state = request.args.get('state')
# get函数用于可选参数,在未接收到参数时返回空值
if keyword:
ret = Task.find_task_by_name(keyword, pagesize * (currentpage - 1), pagesize)
ret = Task.find_task_by_name(keyword, pagesize*(currentpage-1), pagesize)
elif creator:
if state:
ret = Task.find_task_check(creator, pagesize * (currentpage - 1), pagesize)
......@@ -29,7 +29,7 @@ def get_tasks():
else:
ret = Task.find_task_my_task(executor, pagesize * (currentpage - 1), pagesize)
else:
ret = Task.find_task(pagesize * (currentpage - 1), pagesize)
ret = Task.find_task(pagesize*(currentpage-1), pagesize)
res = {
'code': ret.code,
'message': ret.message,
......@@ -44,8 +44,8 @@ def get_tasks():
@task.route("/createTask", methods=["Post"])
def create_task():
data = request.get_json(silent=True)
print(data)
id = int(data['taskId'])
userid=int(data['userId'])
if id >= 0:
find_slice = Slice.find_slice_by_task(id)
if find_slice.code == 1:
......@@ -56,10 +56,8 @@ def create_task():
Task.delete_task(id)
ret = Task.create_task(data['userId'], data['taskName'])
tid = ret.data
score=len(data['task']['domains'])+len(data['task']['pictureDomains'])+len(data['task']['layerDomains'])
if ret.code==1:
User.add_post_score(userid,score)
i = 0
print(data)
while i < len(data['task']['domains']):
s = Slice.create_text_slice(tid, data['task']['domains'][i]['templateId'])
j = 0
......@@ -96,6 +94,7 @@ def create_task():
}
return json.dumps(res)
@task.route("/deleteTask", methods=["GET"])
def delete_task():
taskId = request.args['taskId']
......@@ -214,7 +213,7 @@ def grade():
else:
User.add_image_score(userId, score)
ret = Relation.set_grade(userId, data_id, score)
ret = Relation.set_grade(userId, slice_id, score)
res = {
'code': ret.code,
'message': ret.message,
......
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