populate_db: Restore users' pointers to last after database resets.

(imported from commit d6c5a58173602e7e07b6851a6d22ed129b4f3733)
This commit is contained in:
Tim Abbott 2012-10-02 16:58:13 -04:00
parent 5a5b5de650
commit be1a890a09
1 changed files with 8 additions and 0 deletions

View File

@ -199,6 +199,14 @@ class Command(BaseCommand):
if options["replay_old_zephyrs"]:
restore_saved_zephyrs()
# Set restored pointers to the very latest messages
for user_profile in UserProfile.objects.all():
ids = [u.message_id for u in UserMessage.objects.filter(user_profile = user_profile)]
if ids != []:
user_profile.pointer = max(ids)
user_profile.save()
recipient_hash = {}
def get_recipient_by_id(rid):
if rid in recipient_hash: