From 3260a7ad66d5a9d3b40a0810a7c95abe098cc8f9 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Wed, 7 Sep 2022 23:03:38 +0300 Subject: [PATCH] reacted stat storage fix --- services/stat/reacted.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/services/stat/reacted.py b/services/stat/reacted.py index 077cef0e..60bfe1a4 100644 --- a/services/stat/reacted.py +++ b/services/stat/reacted.py @@ -221,21 +221,19 @@ class ReactedStorage: for slug in dict(self.reacted['shouts']).keys(): topics = session.query(ShoutTopic.topic).where(ShoutTopic.shout == slug).all() reactions = self.reacted['shouts'].get(slug, []) - print('[stat.reacted] shout {' + str(slug) + "}: " + str(len(reactions))) + # print('[stat.reacted] shout {' + str(slug) + "}: " + str(len(reactions))) for ts in list(topics): tslug = ts[0] - topic_reactions = self.reacted["topics"][tslug] - if not topic_reactions: - topic_reactions = [] + topic_reactions = self.reacted["topics"].get(tslug, []) topic_reactions += reactions - print('[stat.reacted] topic {' + str(tslug) + "}: " + str(len(topic_reactions))) + # print('[stat.reacted] topic {' + str(tslug) + "}: " + str(len(topic_reactions))) reactions += list(self.reacted['reactions'].values()) for reaction in reactions: if getattr(reaction, "modified", False): session.add(reaction) flag_modified(reaction, "value") reaction.modified = False - print('flushing') + # print('flushing') for reaction in self.to_flush: session.add(reaction) self.to_flush.clear()