migrate main topic

This commit is contained in:
knst-kotov
2021-12-15 21:13:54 +03:00
parent c66efd5e1f
commit eb67d6a52d
2 changed files with 6 additions and 1 deletions

View File

@@ -90,7 +90,11 @@ def migrate(entry, users_by_oid, topics_by_oid):
# print(entry)
raise Exception
topic_oids = set(entry['category'])
category = entry['category']
mainTopic = topics_by_oid.get(category)
if mainTopic:
r['mainTopic'] = mainTopic["slug"]
topic_oids = set(category)
topic_oids.update(entry.get("tags", []))
for oid in topic_oids:
if oid in topics_by_oid: