Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DA-Platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
文档服务地址:
http://47.92.0.57:3000/
周报索引地址:
http://47.92.0.57:3000/s/NruNXRYmV
Open sidebar
Berlin
DA-Platform
Commits
693f3927
Commit
693f3927
authored
Jul 29, 2020
by
李景熙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改审核界面中的进度显示问题
parent
78bb1298
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
Relation.py
DAPlatform/dao/Relation.py
+11
-6
task.py
DAPlatform/views/task.py
+7
-9
No files found.
DAPlatform/dao/Relation.py
View file @
693f3927
...
@@ -5,6 +5,10 @@ from dao import Slice, Task, User
...
@@ -5,6 +5,10 @@ from dao import Slice, Task, User
class
Result
:
class
Result
:
code
:
int
message
:
[]
data
:
{}
def
__init__
(
self
,
code
,
message
,
data
):
def
__init__
(
self
,
code
,
message
,
data
):
self
.
code
=
code
self
.
code
=
code
self
.
message
=
message
self
.
message
=
message
...
@@ -40,10 +44,11 @@ def create_relation(slice_id, user_id, data_id):
...
@@ -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
:
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
.
score
=
score
relation
.
flag2
=
True
relation
.
save
()
relation
.
save
()
except
:
except
:
return
Result
(
0
,
"grade failed"
,
{})
return
Result
(
0
,
"grade failed"
,
{})
...
@@ -120,6 +125,7 @@ def get_completed_num(sliceId):
...
@@ -120,6 +125,7 @@ def get_completed_num(sliceId):
else
:
else
:
return
num
return
num
# 获取某用户,某分片的标注进度
# 获取某用户,某分片的标注进度
def
get_flag_count
(
userId
,
sliceId
):
def
get_flag_count
(
userId
,
sliceId
):
try
:
try
:
...
@@ -164,7 +170,7 @@ def get_state(user_id, data_id):
...
@@ -164,7 +170,7 @@ def get_state(user_id, data_id):
# 获取某文件的标注者信息
# 获取某文件的标注者信息
def
get_executors
(
data_id
):
def
get_executors
(
data_id
):
try
:
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
index
=
0
list
=
[]
list
=
[]
while
index
<
len
(
find
):
while
index
<
len
(
find
):
...
@@ -193,8 +199,7 @@ def get_relation_id(uid, did):
...
@@ -193,8 +199,7 @@ def get_relation_id(uid, did):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# Relation.drop_table()
Relation
.
drop_table
()
# Relation.create_table()
Relation
.
create_table
()
print
(
get_executors
(
4
)
.
data
)
# print(get_state(1, 5))
# print(get_state(1, 5))
# create_relation(3, 1, 2)
# create_relation(3, 1, 2)
DAPlatform/views/task.py
View file @
693f3927
...
@@ -17,7 +17,7 @@ def get_tasks():
...
@@ -17,7 +17,7 @@ def get_tasks():
state
=
request
.
args
.
get
(
'state'
)
state
=
request
.
args
.
get
(
'state'
)
# get函数用于可选参数,在未接收到参数时返回空值
# get函数用于可选参数,在未接收到参数时返回空值
if
keyword
:
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
:
elif
creator
:
if
state
:
if
state
:
ret
=
Task
.
find_task_check
(
creator
,
pagesize
*
(
currentpage
-
1
),
pagesize
)
ret
=
Task
.
find_task_check
(
creator
,
pagesize
*
(
currentpage
-
1
),
pagesize
)
...
@@ -29,7 +29,7 @@ def get_tasks():
...
@@ -29,7 +29,7 @@ def get_tasks():
else
:
else
:
ret
=
Task
.
find_task_my_task
(
executor
,
pagesize
*
(
currentpage
-
1
),
pagesize
)
ret
=
Task
.
find_task_my_task
(
executor
,
pagesize
*
(
currentpage
-
1
),
pagesize
)
else
:
else
:
ret
=
Task
.
find_task
(
pagesize
*
(
currentpage
-
1
),
pagesize
)
ret
=
Task
.
find_task
(
pagesize
*
(
currentpage
-
1
),
pagesize
)
res
=
{
res
=
{
'code'
:
ret
.
code
,
'code'
:
ret
.
code
,
'message'
:
ret
.
message
,
'message'
:
ret
.
message
,
...
@@ -44,8 +44,8 @@ def get_tasks():
...
@@ -44,8 +44,8 @@ def get_tasks():
@task.route
(
"/createTask"
,
methods
=
[
"Post"
])
@task.route
(
"/createTask"
,
methods
=
[
"Post"
])
def
create_task
():
def
create_task
():
data
=
request
.
get_json
(
silent
=
True
)
data
=
request
.
get_json
(
silent
=
True
)
print
(
data
)
id
=
int
(
data
[
'taskId'
])
id
=
int
(
data
[
'taskId'
])
userid
=
int
(
data
[
'userId'
])
if
id
>=
0
:
if
id
>=
0
:
find_slice
=
Slice
.
find_slice_by_task
(
id
)
find_slice
=
Slice
.
find_slice_by_task
(
id
)
if
find_slice
.
code
==
1
:
if
find_slice
.
code
==
1
:
...
@@ -56,10 +56,8 @@ def create_task():
...
@@ -56,10 +56,8 @@ def create_task():
Task
.
delete_task
(
id
)
Task
.
delete_task
(
id
)
ret
=
Task
.
create_task
(
data
[
'userId'
],
data
[
'taskName'
])
ret
=
Task
.
create_task
(
data
[
'userId'
],
data
[
'taskName'
])
tid
=
ret
.
data
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
i
=
0
print
(
data
)
while
i
<
len
(
data
[
'task'
][
'domains'
]):
while
i
<
len
(
data
[
'task'
][
'domains'
]):
s
=
Slice
.
create_text_slice
(
tid
,
data
[
'task'
][
'domains'
][
i
][
'templateId'
])
s
=
Slice
.
create_text_slice
(
tid
,
data
[
'task'
][
'domains'
][
i
][
'templateId'
])
j
=
0
j
=
0
...
@@ -96,6 +94,7 @@ def create_task():
...
@@ -96,6 +94,7 @@ def create_task():
}
}
return
json
.
dumps
(
res
)
return
json
.
dumps
(
res
)
@task.route
(
"/deleteTask"
,
methods
=
[
"GET"
])
@task.route
(
"/deleteTask"
,
methods
=
[
"GET"
])
def
delete_task
():
def
delete_task
():
taskId
=
request
.
args
[
'taskId'
]
taskId
=
request
.
args
[
'taskId'
]
...
@@ -214,10 +213,10 @@ def grade():
...
@@ -214,10 +213,10 @@ def grade():
else
:
else
:
User
.
add_image_score
(
userId
,
score
)
User
.
add_image_score
(
userId
,
score
)
ret
=
Relation
.
set_grade
(
userId
,
data
_id
,
score
)
ret
=
Relation
.
set_grade
(
userId
,
slice
_id
,
score
)
res
=
{
res
=
{
'code'
:
ret
.
code
,
'code'
:
ret
.
code
,
'message'
:
ret
.
message
,
'message'
:
ret
.
message
,
'data'
:
ret
.
data
'data'
:
ret
.
data
}
}
return
json
.
dumps
(
res
)
return
json
.
dumps
(
res
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment