reacted stat storage fix
This commit is contained in:
parent
00181e7114
commit
3260a7ad66
|
@ -221,21 +221,19 @@ class ReactedStorage:
|
||||||
for slug in dict(self.reacted['shouts']).keys():
|
for slug in dict(self.reacted['shouts']).keys():
|
||||||
topics = session.query(ShoutTopic.topic).where(ShoutTopic.shout == slug).all()
|
topics = session.query(ShoutTopic.topic).where(ShoutTopic.shout == slug).all()
|
||||||
reactions = self.reacted['shouts'].get(slug, [])
|
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):
|
for ts in list(topics):
|
||||||
tslug = ts[0]
|
tslug = ts[0]
|
||||||
topic_reactions = self.reacted["topics"][tslug]
|
topic_reactions = self.reacted["topics"].get(tslug, [])
|
||||||
if not topic_reactions:
|
|
||||||
topic_reactions = []
|
|
||||||
topic_reactions += reactions
|
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())
|
reactions += list(self.reacted['reactions'].values())
|
||||||
for reaction in reactions:
|
for reaction in reactions:
|
||||||
if getattr(reaction, "modified", False):
|
if getattr(reaction, "modified", False):
|
||||||
session.add(reaction)
|
session.add(reaction)
|
||||||
flag_modified(reaction, "value")
|
flag_modified(reaction, "value")
|
||||||
reaction.modified = False
|
reaction.modified = False
|
||||||
print('flushing')
|
# print('flushing')
|
||||||
for reaction in self.to_flush:
|
for reaction in self.to_flush:
|
||||||
session.add(reaction)
|
session.add(reaction)
|
||||||
self.to_flush.clear()
|
self.to_flush.clear()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user