onboarding: Rename variable to cutoff_date.

This is just as clear in terms of intent, and it's robust to
us tweaking the number of weeks.
This commit is contained in:
Steve Howell 2023-07-13 18:07:54 +00:00 committed by Tim Abbott
parent 0891f9f65a
commit 4533ff3671
1 changed files with 2 additions and 2 deletions

View File

@ -180,9 +180,9 @@ def add_new_user_history(user_profile: UserProfile, streams: Iterable[Stream]) -
recipient_ids = [stream.recipient_id for stream in streams if not stream.invite_only]
# Start by finding recent messages matching those recipients.
one_month_ago = timezone_now() - ONBOARDING_RECENT_TIMEDELTA
cutoff_date = timezone_now() - ONBOARDING_RECENT_TIMEDELTA
recent_message_ids = set(
Message.objects.filter(recipient_id__in=recipient_ids, date_sent__gt=one_month_ago)
Message.objects.filter(recipient_id__in=recipient_ids, date_sent__gt=cutoff_date)
.order_by("-id")
.values_list("id", flat=True)[0:MAX_NUM_ONBOARDING_MESSAGES]
)