From e7dc7c5641b97e1fb16d93870f96ce6f9e219ceb Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 15 Mar 2023 07:09:46 +0200 Subject: [PATCH] fix --- files/helpers/roulette.py | 1 + files/helpers/twentyone.py | 1 + files/routes/notifications.py | 12 ++++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/files/helpers/roulette.py b/files/helpers/roulette.py index f1fb3754b..8df9000ac 100644 --- a/files/helpers/roulette.py +++ b/files/helpers/roulette.py @@ -9,6 +9,7 @@ from files.classes.casino_game import CasinoGame from files.helpers.alerts import * from files.helpers.get import get_account from files.helpers.casino import distribute_wager_badges +from files.helpers.config.const import * class RouletteAction(str, Enum): STRAIGHT_UP_BET = "STRAIGHT_UP_BET", diff --git a/files/helpers/twentyone.py b/files/helpers/twentyone.py index 1d1011251..d1d635b3b 100644 --- a/files/helpers/twentyone.py +++ b/files/helpers/twentyone.py @@ -7,6 +7,7 @@ from flask import g from files.classes.casino_game import CasinoGame from files.helpers.casino import distribute_wager_badges +from files.helpers.config.const import * class BlackjackStatus(str, Enum): PLAYING = "PLAYING" diff --git a/files/routes/notifications.py b/files/routes/notifications.py index 95d511b1a..522aa96ea 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -23,6 +23,7 @@ def clear(v): v.last_viewed_post_notifs = int(time.time()) v.last_viewed_log_notifs = int(time.time()) db.add(v) + db.flush() return {"message": "Notifications marked as read!"} @@ -41,7 +42,8 @@ def unread(v): for n, c in listing: n.read = True db.add(n) - + + db.flush() return {"data":[x[1].json for x in listing]} @@ -60,7 +62,7 @@ def notifications_modmail(v): next_exists = (len(comments) > PAGE_SIZE) listing = comments[:PAGE_SIZE] - db.commit() + db.flush() if v.client: return {"data":[x.json for x in listing]} @@ -123,7 +125,7 @@ def notifications_messages(v:User): Notification.user_id == v.id, Notification.comment_id.in_(notifs_unread), ).update({Notification.read: True}) - db.commit() + db.flush() next_exists = (len(message_threads) > 25) listing = message_threads[:25] @@ -178,6 +180,7 @@ def notifications_posts(v:User): if not session.get("GLOBAL"): v.last_viewed_post_notifs = int(time.time()) db.add(v) + db.flush() if v.client: return {"data":[x.json for x in listing]} @@ -227,6 +230,7 @@ def notifications_modactions(v:User): if not session.get("GLOBAL"): v.last_viewed_log_notifs = int(time.time()) db.add(v) + db.flush() return render_template("notifications.html", v=v, @@ -396,7 +400,7 @@ def notifications(v:User): total_cids = set(total_cids) output = get_comments_v_properties(v, None, Comment.id.in_(total_cids))[1] - db.commit() + db.flush() if v.client: return {"data":[x.json for x in listing]}