Skip to content

Commit

Permalink
Re-use page for interaction query (jointakahe#351)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tabletcorry authored Jan 4, 2023
1 parent 69b0430 commit 9ae9e03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions activities/views/timelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ def get_context_data(self):
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
Expand Down

0 comments on commit 9ae9e03

Please sign in to comment.