From e5b2675f0d0efe59701befba51302424843121c6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 1 Sep 2022 21:05:37 +0200 Subject: [PATCH] try to fix db 500 errors on wpd --- files/routes/settings.py | 2 +- files/routes/votes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/settings.py b/files/routes/settings.py index 20e3fa5d7..11e9c0ad4 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -354,7 +354,7 @@ def gumroad(v): procoins = procoins_li[tier] - procoins_li[v.patron] if procoins < 0: return {"error": f"{patron} rewards already claimed"}, 400 - existing = g.db.query(User.id).filter(User.email == v.email, User.is_activated == True, User.patron >= tier).one_or_none() + existing = g.db.query(User.id).filter(User.email == v.email, User.is_activated == True, User.patron >= tier).first() if existing: return {"error": f"{patron} rewards already claimed on another account"}, 400 v.patron = tier diff --git a/files/routes/votes.py b/files/routes/votes.py index b08338e85..2965b734a 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -159,7 +159,7 @@ def vote_comment(comment_id, new, v): coin_mult = 1 - g.db.flush() + g.db.commit() existing = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).one_or_none() if DOUBLE_XP_ENABLED > 0: