mirror of
https://github.com/zulip/zulip.git
synced 2025-10-22 20:42:14 +00:00
update_subscriber_counts: Fix union typing.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
2eb2d5b6de
commit
7f3bb4523c
@@ -5,7 +5,7 @@ from typing import Any
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.models import QuerySet
|
||||
from django.db.models import F, QuerySet
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
@@ -85,10 +85,12 @@ accurate; this command is run as a daily cron job to ensure the number is accura
|
||||
streams_from_users = streams_from_users.filter(realm=realm)
|
||||
|
||||
stream_ids: QuerySet[Any, int] = (
|
||||
changed_subs.values_list("modified_stream_id", flat=True)
|
||||
.distinct()
|
||||
changed_subs.distinct("modified_stream_id")
|
||||
.order_by("modified_stream_id")
|
||||
).union(streams_from_users.values_list("id", flat=True))
|
||||
.annotate(stream_id=F("modified_stream_id"))
|
||||
.union(streams_from_users.annotate(stream_id="id"))
|
||||
.values_list("stream_id", flat=True)
|
||||
)
|
||||
elif realm := self.get_realm(options):
|
||||
stream_ids = streams.filter(realm=realm).values_list("id", flat=True)
|
||||
else:
|
||||
|
Reference in New Issue
Block a user