Forcing unread recalcs on feed open. May fix a bunch of mis-calced unreads.

This commit is contained in:
Samuel Clay 2012-08-10 14:22:51 -07:00
parent 432a26356a
commit 2a7af9d20e
4 changed files with 10 additions and 0 deletions

1
.gitignore vendored
View file

@ -20,5 +20,6 @@ xcuserdata
*.mode1v3
*.pbxuser
media/maintenance.html
media/maintenance.html.unused
config/settings
static.tgz

View file

@ -508,7 +508,9 @@ def load_single_feed(request, feed_id):
if usersub:
usersub.feed_opens += 1
usersub.needs_unread_recalc = True
usersub.save()
diff1 = checkpoint1-start
diff2 = checkpoint2-start
diff3 = checkpoint3-start

View file

@ -828,6 +828,7 @@ class Feed(models.Model):
def update_read_stories_with_new_guid(self, old_story_guid, new_story_guid):
from apps.reader.models import MUserStory
from apps.social.models import MSharedStory
read_stories = MUserStory.objects.filter(feed_id=self.pk, story_id=old_story_guid)
for story in read_stories:
story.story_id = new_story_guid
@ -836,6 +837,11 @@ class Feed(models.Model):
except OperationError:
# User read both new and old. Just toss.
pass
shared_stories = MSharedStory.objects.filter(story_feed_id=self.pk,
story_guid=old_story_guid)
for story in shared_stories:
story.story_guid = new_story_guid
story.save()
def save_popular_tags(self, feed_tags=None, verbose=False):
if not feed_tags:

View file

@ -165,6 +165,7 @@ def load_social_stories(request, user_id, username=None):
if socialsub:
socialsub.feed_opens += 1
socialsub.needs_unread_recalc = True
socialsub.save()
diff1 = checkpoint1-start