Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: same numbers everywhere #21848

Merged
merged 7 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions posthog/heatmaps/heatmaps_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime, date
from typing import Any, List # noqa: UP035
from typing import Any

from rest_framework import viewsets, request, response, serializers, status

Expand All @@ -17,17 +17,17 @@
from posthog.utils import relative_date_parse_with_delta_mapping

DEFAULT_QUERY = """
select pointer_target_fixed, relative_client_x, client_y, {aggregation_count}
select pointer_target_fixed, pointer_relative_x, client_y, {aggregation_count}
from (
select
distinct_id,
pointer_target_fixed,
round((x / viewport_width), 2) as relative_client_x,
round((x / viewport_width), 2) as pointer_relative_x,
y * scale_factor as client_y
from heatmaps
where {predicates}
)
group by `pointer_target_fixed`, relative_client_x, client_y
group by `pointer_target_fixed`, pointer_relative_x, client_y
"""

SCROLL_DEPTH_QUERY = """
Expand Down Expand Up @@ -154,7 +154,7 @@ def _choose_aggregation(self, aggregation, is_scrolldepth_query):
return aggregation_count

@staticmethod
def _predicate_expressions(placeholders: dict[str, Expr]) -> List[ast.Expr]: # noqa: UP006
def _predicate_expressions(placeholders: dict[str, Expr]) -> list[ast.Expr]: # noqa: UP006
predicate_expressions: list[ast.Expr] = []

predicate_mapping: dict[str, str] = {
Expand All @@ -163,8 +163,8 @@ def _predicate_expressions(placeholders: dict[str, Expr]) -> List[ast.Expr]: #
"type": "`type` = {type}",
# optional
"date_to": "timestamp <= {date_to} + interval 1 day",
"viewport_width_min": "viewport_width >= ceil({viewport_width_min} / 16)",
"viewport_width_max": "viewport_width <= ceil({viewport_width_max} / 16)",
Comment on lines -166 to -167
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the query side this is the only change

"viewport_width_min": "viewport_width >= round({viewport_width_min} / 16)",
"viewport_width_max": "viewport_width <= round({viewport_width_max} / 16)",
"url_exact": "current_url = {url_exact}",
"url_pattern": "match(current_url, {url_pattern})",
}
Expand Down
Loading
Loading