Commit 4dc871d1 authored by lixiaofang's avatar lixiaofang

add

parent 0840e780
......@@ -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))
......
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