Tweaked voting logic
This commit is contained in:
@@ -838,8 +838,6 @@ class Room:
|
||||
print(f"Failed to post suggestion {idx}: {resp}")
|
||||
continue
|
||||
|
||||
post.is_posted = True
|
||||
|
||||
reaction = {
|
||||
"m.relates_to": {
|
||||
"rel_type": "m.annotation",
|
||||
@@ -855,7 +853,6 @@ class Room:
|
||||
|
||||
await asyncio.sleep(self.config.post_interval)
|
||||
|
||||
self.mark_posts_as_posted([p for p in unposted_posts if p.is_posted])
|
||||
print("Suggestions posted!")
|
||||
|
||||
def mark_posts_as_posted(self, posts=None):
|
||||
@@ -873,6 +870,13 @@ class Room:
|
||||
dbutil.commit(conn)
|
||||
conn.close()
|
||||
|
||||
def mark_submissions_posted(self):
|
||||
conn = dbutil.connect(self.db_path)
|
||||
c = conn.cursor()
|
||||
_ = c.execute("UPDATE suggestions SET is_posted = 1 WHERE is_posted = 0")
|
||||
dbutil.commit(conn)
|
||||
conn.close()
|
||||
|
||||
async def close(self):
|
||||
if self.client:
|
||||
await self.client.close()
|
||||
|
||||
Reference in New Issue
Block a user