Commit 4db1d038 authored by 段英荣's avatar 段英荣

modify bug

parent 9750966e
...@@ -155,7 +155,7 @@ class ESPerform(object): ...@@ -155,7 +155,7 @@ class ESPerform(object):
bulk_actions = [] bulk_actions = []
if sub_index_name=="topic": if sub_index_name=="topic" or sub_index_name=="topic-star-routing":
for data in data_list: for data in data_list:
if data: if data:
bulk_actions.append({ bulk_actions.append({
......
...@@ -75,12 +75,19 @@ class Pictorial(models.Model): ...@@ -75,12 +75,19 @@ class Pictorial(models.Model):
def get_effective(self,topic_id_list): def get_effective(self,topic_id_list):
try: try:
topic_id_list = Topic.objects.filter(id__in=topic_id_list,content_level__in=[3,4,5,0],is_online=True).count() effective_num = 0
if topic_id_list >= 5: ret = False
return True
else: for topic_id in topic_id_list:
return False topic_id_object = Topic.objects.filter(id=topic_id).first()
if topic_id_object and topic_id_object.is_online and topic_id_object.content_level in (0,3,4,5):
effective_num += 1
if effective_num >= 5:
ret = True
break
return ret
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False return False
......
...@@ -143,8 +143,6 @@ class TypeInfo(object): ...@@ -143,8 +143,6 @@ class TypeInfo(object):
)) ))
else: else:
if data: if data:
data_list.append(data)
if self.type == "topic": if self.type == "topic":
ori_topic_star = redis_client.hget(self.physical_topic_star, data["id"]) ori_topic_star = redis_client.hget(self.physical_topic_star, data["id"])
if not ori_topic_star: if not ori_topic_star:
...@@ -159,6 +157,7 @@ class TypeInfo(object): ...@@ -159,6 +157,7 @@ class TypeInfo(object):
data_list.append(old_data) data_list.append(old_data)
redis_client.hset(self.physical_topic_star, data["id"], data["content_level"]) redis_client.hset(self.physical_topic_star, data["id"], data["content_level"])
data_list.append(data)
# if self.type=="topic" and instance.content_level and int(instance.content_level)>=4: # if self.type=="topic" and instance.content_level and int(instance.content_level)>=4:
# topic_data_high_star_list.append(data) # topic_data_high_star_list.append(data)
......
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