master
Aevann1 2022-02-26 18:00:49 +02:00
parent 49a75f14f2
commit 42091c427a
1 changed files with 6 additions and 2 deletions

View File

@ -64,14 +64,17 @@ def merge(v, id1, id2):
if not user1.has_badge(badge.badge_id):
badge.user_id = user1.id
g.db.add(badge)
g.db.flush()
for mod in mods:
if not user1.mods(mod.sub):
mod.user_id = user1.id
g.db.add(mod)
g.db.flush()
for exile in exiles:
if not user1.exiled_from(exile.sub):
exile.user_id = user1.id
g.db.add(exile)
g.db.flush()
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truecoins', 'procoins', 'subs_created'):
amount = getattr(user1, kind) + getattr(user2, kind)
@ -118,11 +121,12 @@ def merge_all(v, id):
g.db.add(thing)
things = g.db.query(Badge).filter(Badge.user_id.in_(alt_ids)).all()
for badge in things:
badges = g.db.query(Badge).filter(Badge.user_id.in_(alt_ids)).all()
for badge in badges:
if not user.has_badge(badge.badge_id):
badge.user_id = user.id
g.db.add(badge)
g.db.flush()
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'):