From 4a93626040aa3ed4bff48447857d5b079152489c Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 25 Dec 2022 07:54:34 +0200 Subject: [PATCH] partially revert prev commit and fix it --- files/routes/admin.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 74f75dc08..c70ddc648 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -47,9 +47,11 @@ def _moveacc(old_id, new_id): 'coins', 'coins_spent', 'coins_spent_on_hats', + 'comment_count', 'currently_held_lottery_tickets', 'lootboxes_bought', 'marseybux', + 'post_count', 'received_award_count', 'total_held_lottery_tickets', 'total_lottery_winnings', @@ -61,10 +63,6 @@ def _moveacc(old_id, new_id): setattr(newuser, attr, amount) setattr(olduser, attr, 0) - newuser.stored_subscriber_count = db.query(Follow).filter_by(target_id=newuser.id).count() - newuser.post_count = db.query(Submission).filter_by(author_id=newuser.id).count() - newuser.comment_count = db.query(Comment).filter_by(author_id=newuser.id).count() - if newuser.created_utc > olduser.created_utc: newuser.created_utc = olduser.created_utc @@ -141,6 +139,12 @@ def _moveacc(old_id, new_id): print(e, flush=True) abort(500, str(e)) + olduser.stored_subscriber_count = db.query(Follow).filter_by(target_id=olduser.id).count() + newuser.stored_subscriber_count = db.query(Follow).filter_by(target_id=newuser.id).count() + + db.add(newuser) + db.add(olduser) + update_statement = f'''update submissions set body_html=replace(body_html, '', '') where body_html like '%%'; update comments set body_html=replace(body_html, '', '') where body_html like '%%'; update subs set sidebar_html=replace(sidebar_html, '', '') where sidebar_html like '%%';