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:
ss62171
2019-02-01 03:44:25 +05:30
committed by Tim Abbott
parent 5fd9748e13
commit 5649b954ef

View File

@@ -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("")