Fixing disappearing stories bug when using oldest or unread filter, since as a story gets read it no longer counts against the unread count, resulting in an off-by-one per read story bug.

This commit is contained in:
Samuel Clay 2012-12-06 17:33:56 -08:00
parent a723b79d25
commit 17c4b2e041
2 changed files with 18 additions and 18 deletions

View file

@ -112,6 +112,11 @@ class UserSubscription(models.Model):
read_stories_key = 'RS:%s:%s' % (self.user_id, self.feed_id)
unread_stories_key = 'U:%s:%s' % (self.user_id, self.feed_id)
unread_ranked_stories_key = 'zU:%s:%s' % (self.user_id, self.feed_id)
if offset and not withscores and r.exists(unread_ranked_stories_key):
pass
else:
r.delete(unread_ranked_stories_key)
if not r.exists(stories_key):
print " ---> No stories on feed: %s" % self
return []
@ -151,8 +156,8 @@ class UserSubscription(models.Model):
len(debug_stories),
debug_stories)
story_ids = byscorefunc(unread_ranked_stories_key, min_score,
max_score, start=offset, num=limit,
withscores=withscores)
max_score, start=offset, num=500,
withscores=withscores)[:limit]
r.expire(unread_ranked_stories_key, 24*60*60)
if not ignore_user_stories:
r.delete(unread_stories_key)

View file

@ -1,11 +1,6 @@
//
// Prefix header for all source files of the 'NewsBlur' target in the 'NewsBlur' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
// #import "TestFlight.h"
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \