Re-use page for interaction query (#351)

Original code caused the query on timeline to issue twice. Once to satisfy the interactions lookup (which had no LIMIT) and then again for the page (which had a LIMIT 25).

Presumably we want interactions for the paginated events, especially since the un-LIMITed query would become extremely inefficient.
pull/354/head
Corry Haines 2023-01-04 15:42:57 -08:00 zatwierdzone przez GitHub
rodzic 69b0430819
commit 9ae9e03b9d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -25,14 +25,15 @@ class Home(TemplateView):
events = TimelineService(self.request.identity).home()
paginator = Paginator(events, 25)
page_number = self.request.GET.get("page")
event_page = paginator.get_page(page_number)
context = {
"interactions": PostInteraction.get_event_interactions(
events,
event_page,
self.request.identity,
),
"current_page": "home",
"allows_refresh": True,
"page_obj": paginator.get_page(page_number),
"page_obj": event_page,
"form": self.form_class(request=self.request),
}
return context