forked from MarseyWorld/MarseyWorld
partially revert prev commit and fix it
parent
2f48039a4b
commit
4a93626040
|
@ -47,9 +47,11 @@ def _moveacc(old_id, new_id):
|
||||||
'coins',
|
'coins',
|
||||||
'coins_spent',
|
'coins_spent',
|
||||||
'coins_spent_on_hats',
|
'coins_spent_on_hats',
|
||||||
|
'comment_count',
|
||||||
'currently_held_lottery_tickets',
|
'currently_held_lottery_tickets',
|
||||||
'lootboxes_bought',
|
'lootboxes_bought',
|
||||||
'marseybux',
|
'marseybux',
|
||||||
|
'post_count',
|
||||||
'received_award_count',
|
'received_award_count',
|
||||||
'total_held_lottery_tickets',
|
'total_held_lottery_tickets',
|
||||||
'total_lottery_winnings',
|
'total_lottery_winnings',
|
||||||
|
@ -61,10 +63,6 @@ def _moveacc(old_id, new_id):
|
||||||
setattr(newuser, attr, amount)
|
setattr(newuser, attr, amount)
|
||||||
setattr(olduser, attr, 0)
|
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:
|
if newuser.created_utc > olduser.created_utc:
|
||||||
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)
|
print(e, flush=True)
|
||||||
abort(500, str(e))
|
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, '<a href="/id/{old_id}">', '<a href="/id/{new_id}">') where body_html like '%<a href="/id/{old_id}">%';
|
update_statement = f'''update submissions set body_html=replace(body_html, '<a href="/id/{old_id}">', '<a href="/id/{new_id}">') where body_html like '%<a href="/id/{old_id}">%';
|
||||||
update comments set body_html=replace(body_html, '<a href="/id/{old_id}">', '<a href="/id/{new_id}">') where body_html like '%<a href="/id/{old_id}">%';
|
update comments set body_html=replace(body_html, '<a href="/id/{old_id}">', '<a href="/id/{new_id}">') where body_html like '%<a href="/id/{old_id}">%';
|
||||||
update subs set sidebar_html=replace(sidebar_html, '<a href="/id/{old_id}">', '<a href="/id/{new_id}">') where sidebar_html like '%<a href="/id/{old_id}">%';
|
update subs set sidebar_html=replace(sidebar_html, '<a href="/id/{old_id}">', '<a href="/id/{new_id}">') where sidebar_html like '%<a href="/id/{old_id}">%';
|
||||||
|
|
Loading…
Reference in New Issue