Skip to content

Commit

Permalink
fix(exports): breakdown limit (#18597)
Browse files Browse the repository at this point in the history
Use the breakdown limit in the query params for the next page if it exists
  • Loading branch information
Gilbert09 authored Nov 14, 2023
1 parent 595547f commit 2bb378b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions posthog/api/insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,9 +819,16 @@ def trend(self, request: request.Request, *args: Any, **kwargs: Any):
except HogQLException as e:
raise ValidationError(str(e))
filter = Filter(request=request, team=self.team)

params_breakdown_limit = request.GET.get("breakdown_limit")
if params_breakdown_limit is not None and params_breakdown_limit != "":
breakdown_values_limit = int(params_breakdown_limit)
else:
breakdown_values_limit = BREAKDOWN_VALUES_LIMIT

next = (
format_paginated_url(request, filter.offset, BREAKDOWN_VALUES_LIMIT)
if len(result["result"]) >= BREAKDOWN_VALUES_LIMIT
format_paginated_url(request, filter.offset, breakdown_values_limit)
if len(result["result"]) >= breakdown_values_limit
else None
)
if self.request.accepted_renderer.format == "csv":
Expand Down

0 comments on commit 2bb378b

Please sign in to comment.