diff --git a/api/chalicelib/core/heatmaps.py b/api/chalicelib/core/heatmaps.py index b8ec95bee..36b9268ab 100644 --- a/api/chalicelib/core/heatmaps.py +++ b/api/chalicelib/core/heatmaps.py @@ -14,7 +14,7 @@ def get_by_url(project_id, data: schemas.GetHeatMapPayloadSchema): args = {"startDate": data.startTimestamp, "endDate": data.endTimestamp, "project_id": project_id, "url": data.url} constraints = ["sessions.project_id = %(project_id)s", - "(url = %(url)s OR path= %(url)s)", + "path= %(url)s", "clicks.timestamp >= %(startDate)s", "clicks.timestamp <= %(endDate)s", "start_ts >= %(startDate)s", @@ -84,7 +84,7 @@ def get_by_url(project_id, data: schemas.GetHeatMapPayloadSchema): def get_x_y_by_url_and_session_id(project_id, session_id, data: schemas.GetHeatMapPayloadSchema): args = {"session_id": session_id, "url": data.url} constraints = ["session_id = %(session_id)s", - "(url = %(url)s OR path= %(url)s)", + "path= %(url)s", "normalized_x IS NOT NULL"] query_from = "events.clicks" @@ -112,7 +112,7 @@ def get_x_y_by_url_and_session_id(project_id, session_id, data: schemas.GetHeatM def get_selectors_by_url_and_session_id(project_id, session_id, data: schemas.GetHeatMapPayloadSchema): args = {"session_id": session_id, "url": data.url} constraints = ["session_id = %(session_id)s", - "(url = %(url)s OR path= %(url)s)"] + "path= %(url)s"] query_from = "events.clicks" with pg_client.PostgresClient() as cur: diff --git a/api/schemas/schemas.py b/api/schemas/schemas.py index cfe14ceec..a966fcedd 100644 --- a/api/schemas/schemas.py +++ b/api/schemas/schemas.py @@ -1595,7 +1595,7 @@ class HeatMapFilterSchema(BaseModel): class GetHeatMapPayloadSchema(_TimedSchema): - url: Optional[str] = Field(...) + url: Optional[str] = Field(default=None) filters: List[HeatMapFilterSchema] = Field(default=[]) click_rage: bool = Field(default=False) diff --git a/ee/api/chalicelib/core/heatmaps.py b/ee/api/chalicelib/core/heatmaps.py index a3edb41f3..771df669f 100644 --- a/ee/api/chalicelib/core/heatmaps.py +++ b/ee/api/chalicelib/core/heatmaps.py @@ -22,7 +22,7 @@ def get_by_url(project_id, data: schemas.GetHeatMapPayloadSchema): args = {"startDate": data.startTimestamp, "endDate": data.endTimestamp, "project_id": project_id, "url": data.url} constraints = ["main_events.project_id = toUInt16(%(project_id)s)", - "(main_events.url_hostpath = %(url)s OR main_events.url_path = %(url)s)", + "main_events.url_path = %(url)s", "main_events.datetime >= toDateTime(%(startDate)s/1000)", "main_events.datetime <= toDateTime(%(endDate)s/1000)", "main_events.event_type='CLICK'", @@ -94,7 +94,7 @@ def get_x_y_by_url_and_session_id(project_id, session_id, data: schemas.GetHeatM args = {"project_id": project_id, "session_id": session_id, "url": data.url} constraints = ["main_events.project_id = toUInt16(%(project_id)s)", "main_events.session_id = %(session_id)s", - "(main_events.url_hostpath = %(url)s OR main_events.url_path = %(url)s)", + "main_events.url_path = %(url)s", "main_events.event_type='CLICK'", "isNotNull(main_events.normalized_x)"] query_from = f"{exp_ch_helper.get_main_events_table(0)} AS main_events" @@ -124,7 +124,7 @@ def get_selectors_by_url_and_session_id(project_id, session_id, data: schemas.Ge args = {"project_id": project_id, "session_id": session_id, "url": data.url} constraints = ["main_events.project_id = toUInt16(%(project_id)s)", "main_events.session_id = %(session_id)s", - "(main_events.url_hostpath = %(url)s OR main_events.url_path = %(url)s)", + "main_events.url_path = %(url)s", "main_events.event_type='CLICK'"] query_from = f"{exp_ch_helper.get_main_events_table(0)} AS main_events"