From d9d80939b0f54989df1c58271f128a3c77d7938c Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Tue, 3 Apr 2012 20:28:18 -0700 Subject: [PATCH] Fixing bug around refresh social feeds that have no unread stories, so they have no last unread dates. --- apps/social/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/social/models.py b/apps/social/models.py index d0f156cd8..cf799220c 100644 --- a/apps/social/models.py +++ b/apps/social/models.py @@ -446,8 +446,10 @@ class MSocialSubscription(mongo.Document): for i, sub in enumerate(user_subs): # Count unreads if subscription is stale. if (sub.needs_unread_recalc or - sub.unread_count_updated < UNREAD_CUTOFF or - sub.oldest_unread_story_date < UNREAD_CUTOFF): + (sub.unread_count_updated and + sub.unread_count_updated < UNREAD_CUTOFF) or + (sub.oldest_unread_story_date and + sub.oldest_unread_story_date < UNREAD_CUTOFF)): sub = sub.calculate_feed_scores(silent=True) feed_id = "social:%s" % sub.subscription_user_id