Commit 1cac125a authored by lixiaofang's avatar lixiaofang

同步数据

parent c2f61e2c
...@@ -277,12 +277,21 @@ class Topic(models.Model): ...@@ -277,12 +277,21 @@ class Topic(models.Model):
related_billboard_list = list() related_billboard_list = list()
query_results = TopicBillBoard.objects.filter(pictorial_id__in=pictorial_ids) for pictorial_id in pictorial_ids:
for items in query_results: query_result = TopicBillBoard.objects.filter(pictorial_id=pictorial_id,
total_vote_cnt = int(items.virt_vote_cnt) + int(items.real_vote_cnt) topic_id=self.id).values().first()
related_billboard_list.append({"pictorial_id": items.pictorial_id, "real_vote_cnt": items.real_vote_cnt,
"virt_vote_cnt": items.virt_vote_cnt, "total_vote_cnt": total_vote_cnt}) if query_result == None:
related_billboard_list.append({"pictorial_id": pictorial_id, "real_vote_cnt": 0,
"virt_vote_cnt": 0, "total_vote_cnt": 0})
else:
total_vote_cnt = int(query_result["virt_vote_cnt"]) + int(query_result["real_vote_cnt"])
related_billboard_list.append(
{"pictorial_id": query_result["pictorial_id"], "real_vote_cnt": query_result["real_vote_cnt"],
"virt_vote_cnt": query_result["virt_vote_cnt"], "total_vote_cnt": total_vote_cnt})
logging.info("product_brand_info" % related_billboard_list) logging.info("product_brand_info" % related_billboard_list)
......
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