Changing cutoff dates when fetching stories, fixing issues around Oldest first for both unreads and all stories.

This commit is contained in:
Samuel Clay 2022-01-18 15:25:15 -05:00
parent 0baaa951b9
commit fdeca57412
2 changed files with 5 additions and 3 deletions

View file

@ -214,14 +214,16 @@ class UserSubscription(models.Model):
pipeline.execute()
r.delete(unread_ranked_stories_key)
current_time = int(time.time() + 60*60*24)
if not cutoff_date:
cutoff_date = datetime.datetime.now() - datetime.timedelta(days=self.user.profile.days_of_story_hashes)
if read_filter == "unread":
cutoff_date = datetime.datetime.now() - datetime.timedelta(days=self.user.profile.days_of_unread)
cutoff_date = max(cutoff_date, self.mark_read_date)
elif read_filter == "all":
cutoff_date = datetime.datetime.now() - datetime.timedelta(days=self.user.profile.days_of_story_hashes)
elif default_cutoff_date:
cutoff_date = default_cutoff_date
current_time = int(time.time() + 60*60*24)
if order == 'oldest':
byscorefunc = rt.zrangebyscore
if read_filter == 'unread':

View file

@ -33,7 +33,7 @@ DEBUG_ASSETS = True
# down verbosity.
DEBUG_QUERIES = DEBUG
DEBUG_QUERIES_SUMMARY_ONLY = True
# DEBUG_QUERIES_SUMMARY_ONLY = False
DEBUG_QUERIES_SUMMARY_ONLY = False
MEDIA_URL = '/media/'
IMAGES_URL = '/imageproxy'