Skip to content

Commit

Permalink
fix: same numbers everywhere (#21848)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Apr 25, 2024
1 parent d2ed2ea commit 3a7646b
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 146 deletions.
12 changes: 6 additions & 6 deletions posthog/heatmaps/heatmaps_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -106,7 +106,7 @@ class HeatmapsResponseSerializer(serializers.Serializer):
class HeatmapScrollDepthResponseItemSerializer(serializers.Serializer):
cumulative_count = serializers.IntegerField(required=True)
bucket_count = serializers.IntegerField(required=True)
scroll_depth_bucket = serializers.FloatField(required=True)
scroll_depth_bucket = serializers.IntegerField(required=True)


class HeatmapsScrollDepthResponseSerializer(serializers.Serializer):
Expand Down Expand Up @@ -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)",
"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

0 comments on commit 3a7646b

Please sign in to comment.