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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
Relation.py
DAPlatform/dao/Relation.py
+11
-6
task.py
DAPlatform/views/task.py
+6
-7
No files found.
DAPlatform/dao/Relation.py
View file @
693f3927
...
...
@@ -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)
DAPlatform/views/task.py
View file @
693f3927
...
...
@@ -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
,
...
...
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