forked from MarseyWorld/MarseyWorld
badge
parent
9a2a972277
commit
cb59aed6e9
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue