Only use oldest unread story in unread only read filter for archive subscribers. Otherwise it will trim stories older than the oldest unread in All Stories.

This commit is contained in:
Samuel Clay 2022-04-18 16:23:52 -04:00
parent b4c9c4e896
commit 03cab31143
2 changed files with 3 additions and 3 deletions

View file

@ -35,6 +35,7 @@ def FinishFetchArchiveFeeds(results, user_id, start_time, starting_story_count):
ending_story_count, pre_archive_count = UserSubscription.finish_fetch_archive_feeds(user_id, start_time, starting_story_count)
new_story_count = ending_story_count - starting_story_count
user_profile = Profile.objects.get(user__pk=user_id)
user_profile.send_new_premium_archive_email(new_story_count, ending_story_count, pre_archive_count)
@app.task(name="email-new-premium-pro")

View file

@ -257,7 +257,7 @@ class UserSubscription(models.Model):
else:
r.sdiffstore(unread_stories_key, stories_key, read_stories_key)
sorted_stories_key = 'zF:%s' % (self.feed_id)
r.zinterstore(unread_ranked_stories_key, [sorted_stories_key, unread_stories_key])
r.zinterstore(unread_ranked_stories_key, [sorted_stories_key, unread_stories_key])
if order == 'oldest':
removed_min = r.zremrangebyscore(unread_ranked_stories_key, 0, min_score-1)
removed_max = r.zremrangebyscore(unread_ranked_stories_key, max_score+1, 2*max_score)
@ -268,7 +268,7 @@ class UserSubscription(models.Model):
if not ignore_user_stories:
r.delete(unread_stories_key)
if self.user.profile.is_archive:
if self.user.profile.is_archive and read_filter == "unread":
oldest_manual_unread = self.oldest_manual_unread_story_date()
if oldest_manual_unread:
if order == 'oldest':
@ -999,7 +999,6 @@ class UserSubscription(models.Model):
else:
feed_scores['neutral'] += 1
else:
# print " ---> Cutoff date: %s" % date_delta
unread_story_hashes = self.story_hashes(user_id=self.user_id, feed_ids=[self.feed_id],
usersubs=[self],
read_filter='unread', group_by_feed=False,