diff --git a/api/chalicelib/core/heatmaps.py b/api/chalicelib/core/heatmaps.py index 1cfdaa833..b8ec95bee 100644 --- a/api/chalicelib/core/heatmaps.py +++ b/api/chalicelib/core/heatmaps.py @@ -9,6 +9,8 @@ logger = logging.getLogger(__name__) def get_by_url(project_id, data: schemas.GetHeatMapPayloadSchema): + if data.url is None or data.url == "": + return [] args = {"startDate": data.startTimestamp, "endDate": data.endTimestamp, "project_id": project_id, "url": data.url} constraints = ["sessions.project_id = %(project_id)s", diff --git a/api/schemas/schemas.py b/api/schemas/schemas.py index 1cee5c3af..cfe14ceec 100644 --- a/api/schemas/schemas.py +++ b/api/schemas/schemas.py @@ -1595,7 +1595,7 @@ class HeatMapFilterSchema(BaseModel): class GetHeatMapPayloadSchema(_TimedSchema): - url: str = Field(...) + url: Optional[str] = Field(...) 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 848761251..a3edb41f3 100644 --- a/ee/api/chalicelib/core/heatmaps.py +++ b/ee/api/chalicelib/core/heatmaps.py @@ -17,6 +17,8 @@ logger = logging.getLogger(__name__) def get_by_url(project_id, data: schemas.GetHeatMapPayloadSchema): + if data.url is None or data.url == "": + return [] args = {"startDate": data.startTimestamp, "endDate": data.endTimestamp, "project_id": project_id, "url": data.url} constraints = ["main_events.project_id = toUInt16(%(project_id)s)",