Prevent services from showing up twice on homepage

This commit is contained in:
R. Miles McCain 2020-08-28 17:19:07 +00:00
parent 4a06357137
commit c8dead4457
No known key found for this signature in database
GPG Key ID: F1053629E2905557

View File

@ -29,7 +29,7 @@ class DashboardView(LoginRequiredMixin, DateRangeMixin, TemplateView):
data = super().get_context_data(**kwargs) data = super().get_context_data(**kwargs)
data["services"] = Service.objects.filter( data["services"] = Service.objects.filter(
Q(owner=self.request.user) | Q(collaborators__in=[self.request.user]) Q(owner=self.request.user) | Q(collaborators__in=[self.request.user])
) ).distinct()
for service in data["services"]: for service in data["services"]:
service.stats = service.get_core_stats(data["start_date"], data["end_date"]) service.stats = service.get_core_stats(data["start_date"], data["end_date"])
return data return data