Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
search_tips
Project
Project
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
Open sidebar
rank
search_tips
Commits
4dc871d1
Commit
4dc871d1
authored
Jul 03, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
0840e780
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
40 deletions
+25
-40
agile_tag_transfer.py
associate/utils/agile_tag_transfer.py
+25
-40
No files found.
associate/utils/agile_tag_transfer.py
View file @
4dc871d1
...
...
@@ -26,32 +26,28 @@ class TagTransfer(object):
@classmethod
def
get_tag_suggest_data_list
(
cls
,
instance
):
try
:
results
=
agile_tag
.
AgileTagRecommendType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_RECOMMEND_TYPE
.
TRACTATE
)
.
values_list
(
"agile_tag_type"
,
flat
=
True
)
.
first
()
if
results
:
ret_list
=
list
()
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
item_dict
[
"ori_name"
]
=
instance
.
name
.
strip
()
item_dict
[
"is_online"
]
=
instance
.
is_online
random_num
=
random
.
randint
(
10000
,
20000
)
item_dict
[
"results_num"
]
=
random_num
item_dict
[
"offline_score"
]
=
0.0
item_dict
[
"create_tag_type"
]
=
instance
.
create_tag_type
item_dict
[
"style"
]
=
instance
.
style
item_dict
[
"topic_recommend_sort"
]
=
instance
.
topic_recommend_sort
item_dict
[
"agile_tag_type"
]
=
instance
.
get_agile_tag_type
()
item_dict
[
"agile_tag_id"
]
=
instance
.
id
item_dict
[
"api_agile_tag_recommend_type"
]
=
instance
.
get_api_agile_tag_recommend_type
()
ret_list
.
append
(
item_dict
)
suggest_list
=
get_tips_suggest_list
(
instance
.
name
)
logging
.
info
(
"get ret_list:
%
s"
%
ret_list
)
logging
.
info
(
"get suggest_list:
%
s"
%
ret_list
)
ret_list
=
list
()
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
item_dict
[
"ori_name"
]
=
instance
.
name
.
strip
()
item_dict
[
"is_online"
]
=
instance
.
is_online
random_num
=
random
.
randint
(
10000
,
20000
)
item_dict
[
"results_num"
]
=
random_num
item_dict
[
"offline_score"
]
=
0.0
item_dict
[
"create_tag_type"
]
=
instance
.
create_tag_type
item_dict
[
"style"
]
=
instance
.
style
item_dict
[
"topic_recommend_sort"
]
=
instance
.
topic_recommend_sort
item_dict
[
"agile_tag_type"
]
=
instance
.
get_agile_tag_type
()
item_dict
[
"agile_tag_id"
]
=
instance
.
id
item_dict
[
"api_agile_tag_recommend_type"
]
=
instance
.
get_api_agile_tag_recommend_type
()
ret_list
.
append
(
item_dict
)
suggest_list
=
get_tips_suggest_list
(
instance
.
name
)
logging
.
info
(
"get ret_list:
%
s"
%
ret_list
)
logging
.
info
(
"get suggest_list:
%
s"
%
ret_list
)
return
(
item_dict
,
suggest_list
)
return
(
item_dict
,
suggest_list
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
([],
[])
...
...
@@ -93,10 +89,7 @@ class TagTransfer(object):
result
=
agile_tag
.
AgileTagType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_TYPE
.
PROJECT
)
results
=
agile_tag
.
AgileTagRecommendType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_RECOMMEND_TYPE
.
TRACTATE
)
.
values_list
(
"agile_tag_type"
,
flat
=
True
)
.
first
()
if
result
and
results
:
if
result
:
ret_list
=
list
()
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
...
...
@@ -127,10 +120,8 @@ class TagTransfer(object):
try
:
result
=
agile_tag
.
AgileTagType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_TYPE
.
POSITION
)
results
=
agile_tag
.
AgileTagRecommendType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_RECOMMEND_TYPE
.
TRACTATE
)
.
values_list
(
"agile_tag_type"
,
flat
=
True
)
.
first
()
if
result
and
results
:
if
result
:
ret_list
=
list
()
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
...
...
@@ -161,10 +152,7 @@ class TagTransfer(object):
try
:
result
=
agile_tag
.
AgileTagType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_TYPE
.
INSTRUMENT
)
results
=
agile_tag
.
AgileTagRecommendType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_RECOMMEND_TYPE
.
TRACTATE
)
.
values_list
(
"agile_tag_type"
,
flat
=
True
)
.
first
()
if
result
and
results
:
if
result
:
ret_list
=
list
()
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
...
...
@@ -195,10 +183,7 @@ class TagTransfer(object):
try
:
result
=
agile_tag
.
AgileTagType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_TYPE
.
HOSPITAL
)
results
=
agile_tag
.
AgileTagRecommendType
.
objects
.
filter
(
agile_tag_id
=
instance
.
id
,
agile_tag_type
=
AGILE_TAG_RECOMMEND_TYPE
.
TRACTATE
)
.
values_list
(
"agile_tag_type"
,
flat
=
True
)
.
first
()
if
result
and
results
:
if
result
:
ret_list
=
list
()
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
...
...
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