From 5649b954ef646d85f38d921c12b200a9f159c47e Mon Sep 17 00:00:00 2001 From: ss62171 Date: Fri, 1 Feb 2019 03:44:25 +0530 Subject: [PATCH] stream_stats: Add a column representing type of stream. This adds a column which represents whether a stream is public or private. Fixes #11374. --- analytics/management/commands/stream_stats.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/analytics/management/commands/stream_stats.py b/analytics/management/commands/stream_stats.py index 6111cb268b..7e682f9607 100644 --- a/analytics/management/commands/stream_stats.py +++ b/analytics/management/commands/stream_stats.py @@ -40,13 +40,18 @@ class Command(BaseCommand): print("%10s %d public streams and" % ("(", public_count), end=' ') print("%d private streams )" % (private_count,)) print("------------") - print("%25s %15s %10s" % ("stream", "subscribers", "messages")) + print("%25s %15s %10s %12s" % ("stream", "subscribers", "messages", "type")) for stream in streams: + if stream.invite_only: + stream_type = 'private' + else: + stream_type = 'public' print("%25s" % (stream.name,), end=' ') recipient = Recipient.objects.filter(type=Recipient.STREAM, type_id=stream.id) print("%10d" % (len(Subscription.objects.filter(recipient=recipient, active=True)),), end=' ') num_messages = len(Message.objects.filter(recipient=recipient)) - print("%12d" % (num_messages,)) + print("%12d" % (num_messages,), end=' ') + print("%15s" % (stream_type,)) print("")