mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
stream_stats: Add a column representing type of stream.
This adds a column which represents whether a stream is public or private. Fixes #11374.
This commit is contained in:
@@ -40,13 +40,18 @@ class Command(BaseCommand):
|
|||||||
print("%10s %d public streams and" % ("(", public_count), end=' ')
|
print("%10s %d public streams and" % ("(", public_count), end=' ')
|
||||||
print("%d private streams )" % (private_count,))
|
print("%d private streams )" % (private_count,))
|
||||||
print("------------")
|
print("------------")
|
||||||
print("%25s %15s %10s" % ("stream", "subscribers", "messages"))
|
print("%25s %15s %10s %12s" % ("stream", "subscribers", "messages", "type"))
|
||||||
|
|
||||||
for stream in streams:
|
for stream in streams:
|
||||||
|
if stream.invite_only:
|
||||||
|
stream_type = 'private'
|
||||||
|
else:
|
||||||
|
stream_type = 'public'
|
||||||
print("%25s" % (stream.name,), end=' ')
|
print("%25s" % (stream.name,), end=' ')
|
||||||
recipient = Recipient.objects.filter(type=Recipient.STREAM, type_id=stream.id)
|
recipient = Recipient.objects.filter(type=Recipient.STREAM, type_id=stream.id)
|
||||||
print("%10d" % (len(Subscription.objects.filter(recipient=recipient,
|
print("%10d" % (len(Subscription.objects.filter(recipient=recipient,
|
||||||
active=True)),), end=' ')
|
active=True)),), end=' ')
|
||||||
num_messages = len(Message.objects.filter(recipient=recipient))
|
num_messages = len(Message.objects.filter(recipient=recipient))
|
||||||
print("%12d" % (num_messages,))
|
print("%12d" % (num_messages,), end=' ')
|
||||||
|
print("%15s" % (stream_type,))
|
||||||
print("")
|
print("")
|
||||||
|
|||||||
Reference in New Issue
Block a user