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