Remove duplicate data from views screen
@@ -112,19 +112,11 @@ class HomeView(generic.ListView):
def home(request):
ts = get_timestamp()
properties = Property.objects.filter(
+ namespace__topic__timestamp = ts,
).annotate(
- numNamespaces = Subquery(
- Namespace.objects.filter(
- deleted=False,
- timestamp=ts,
- property=OuterRef('pk')
- ).values('property')
- .annotate(cnt=Count('pk'))
- .values('cnt'),
- output_field=IntegerField()
- ),
+ numNamespaces = Count('namespace__name', distinct=True),
numTopics = Count('namespace__topic__name', distinct=True),
- numProducers = Sum('namespace__topic__producerCount'),
+ numProducers = Sum('namespace__topic__producerCount', filter=Q(topic__timestamp__eq=ts)),
numSubscriptions = Sum('namespace__topic__subscriptionCount'),
numConsumers = Sum('namespace__topic__consumerCount'),
backlog = Sum('namespace__topic__backlog'),
