mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Fixing ghost unreads by accounting for the implicit score of 1 in unsorted sets in redis when intersected with a sorted set. Doh!
This commit is contained in:
parent
046fe12e56
commit
825378d83a
2 changed files with 4 additions and 3 deletions
|
@ -128,7 +128,7 @@ class UserSubscription(models.Model):
|
|||
if order == 'oldest':
|
||||
byscorefunc = r.zrangebyscore
|
||||
if read_filter == 'unread' or True:
|
||||
min_score = int(time.mktime(self.mark_read_date.timetuple()))
|
||||
min_score = int(time.mktime(self.mark_read_date.timetuple())) + 1
|
||||
else:
|
||||
now = datetime.datetime.now()
|
||||
two_weeks_ago = now - datetime.timedelta(days=settings.DAYS_OF_UNREAD)
|
||||
|
@ -137,7 +137,8 @@ class UserSubscription(models.Model):
|
|||
else:
|
||||
byscorefunc = r.zrevrangebyscore
|
||||
min_score = current_time
|
||||
max_score = int(time.mktime(self.mark_read_date.timetuple()))
|
||||
# +1 for the intersection b/w zF and F, which carries an implicit score of 1.
|
||||
max_score = int(time.mktime(self.mark_read_date.timetuple())) + 1
|
||||
|
||||
if settings.DEBUG:
|
||||
print " ---> Unread all stories: %s" % r.zrevrange(unread_ranked_stories_key, 0, -1)
|
||||
|
|
|
@ -712,7 +712,7 @@ class MSocialSubscription(mongo.Document):
|
|||
r.zinterstore(unread_ranked_stories_key, [sorted_stories_key, unread_stories_key])
|
||||
|
||||
current_time = int(time.time() + 60*60*24)
|
||||
mark_read_time = int(time.mktime(self.mark_read_date.timetuple()))
|
||||
mark_read_time = int(time.mktime(self.mark_read_date.timetuple())) + 1
|
||||
if order == 'oldest':
|
||||
byscorefunc = r.zrangebyscore
|
||||
min_score = mark_read_time
|
||||
|
|
Loading…
Add table
Reference in a new issue