From bb8f6d119ecda63fe3edf338d022410e6ceeda53 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 21 Jul 2022 13:52:27 +0100 Subject: [PATCH] Print the number of users on the channels in Insights --- core/templates/ui/insights/channels.html | 7 +++++++ core/views/dynamic/insights.py | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/templates/ui/insights/channels.html b/core/templates/ui/insights/channels.html index 5c9fe97..ff8a95a 100644 --- a/core/templates/ui/insights/channels.html +++ b/core/templates/ui/insights/channels.html @@ -1,3 +1,5 @@ +{% load index %} +
@@ -13,6 +15,11 @@ class="button is-small"> {{ chan }} + {% if chan in num_users %} + + {{ num_users|index:chan }} + + {% endif %} {% endfor %} diff --git a/core/views/dynamic/insights.py b/core/views/dynamic/insights.py index f9d868c..a79d42b 100644 --- a/core/views/dynamic/insights.py +++ b/core/views/dynamic/insights.py @@ -43,12 +43,11 @@ class InsightsChannels(LoginRequiredMixin, APIView): return HttpResponse("No nick") net = request.data["net"] nick = request.data["nick"] - print("Insights channels item", nick) chans = get_chans(net, [nick]) - print("GET CHANS", chans) + num_users = annotate_num_users(net, chans) if not chans: return HttpResponseForbidden() - context = {"net": net, "nick": nick, "chans": chans} + context = {"net": net, "nick": nick, "chans": chans, "num_users": num_users} return render(request, self.template_name, context)