From cb59aed6e9a608ec667a03507056ec9e9b7ceb61 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 26 Feb 2022 17:54:39 +0200 Subject: [PATCH] badge --- files/routes/admin.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index af8c3c9be..e8426934c 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -100,18 +100,23 @@ def merge_all(v, id): alt_ids = [x.id for x in user.alts_unique] - things = g.db.query(AwardRelationship).filter(AwardRelationship.user_id.in_(alt_ids)).all() + g.db.query(Badge).filter(Badge.user_id.in_(alt_ids)).all() + g.db.query(Mod).filter(Mod.user_id.in_(alt_ids)).all() + g.db.query(Exile).filter(Exile.user_id.in_(alt_ids)).all() - + things = g.db.query(AwardRelationship).filter(AwardRelationship.user_id.in_(alt_ids)).all() + g.db.query(Mod).filter(Mod.user_id.in_(alt_ids)).all() + g.db.query(Exile).filter(Exile.user_id.in_(alt_ids)).all() for thing in things: thing.user_id = user.id g.db.add(thing) things = g.db.query(Submission).filter(Submission.author_id.in_(alt_ids)).all() + g.db.query(Comment).filter(Comment.author_id.in_(alt_ids)).all() - for thing in things: thing.author_id = user.id g.db.add(thing) + + things = g.db.query(Badge).filter(Badge.user_id.in_(alt_ids)).all() + for badge in things: + if not user.has_badge(badge.badge_id): + badge.user_id = user.id + g.db.add(badge) + for alt in user.alts_unique: for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truecoins', 'procoins', 'subs_created'): amount = getattr(user, kind) + getattr(alt, kind)