Skip to content

Commit ee6ea49

Browse files
committed
fix lag
1 parent 37a0b3d commit ee6ea49

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

user_migrate.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ def migrate_db():
4949
new_coll = mydb['taskLists'] # Can't seem to find a way to easily rewrite to existing collection
5050
new_coll.drop()
5151
users = coll.find({}, {})
52-
53-
for user in users:
52+
users_length = coll.count_documents({})
53+
for i, user in enumerate(users, 1):
5454
new_coll.insert_one(migrate_database_user_to_new_format(user))
55+
print(f"User {i}/{users_length} migrated")
5556

5657

5758
# Below to replace task_database.py add user
@@ -119,3 +120,10 @@ def add_task_account(username, is_official, lms_enabled):
119120
'otherPets': []
120121
}
121122
})
123+
124+
if __name__ == "__main__":
125+
# Uncomment the line below to migrate the database
126+
migrate_db()
127+
# Example usage of add_task_account
128+
# add_task_account("test_user", True, False)
129+
pass

0 commit comments

Comments
 (0)