Skip to content

Commit

Permalink
fix(chalice): fixed autocomplete top 10 meta-filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tahayk committed Aug 14, 2024
1 parent 9b6cd33 commit dcdd47c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/chalicelib/core/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,11 @@ def get_top_values(project_id, event_type, event_key=None):
query = f"""WITH raw AS (SELECT DISTINCT {colname} AS c_value,
COUNT(1) OVER (PARTITION BY {colname}) AS row_count,
COUNT(1) OVER () AS total_count
FROM experimental.sessions
FROM public.sessions
WHERE project_id = %(project_id)s
AND {colname} IS NOT NULL
AND sessions.duration IS NOT NULL
AND sessions.duration > 0
ORDER BY row_count DESC
LIMIT 10)
SELECT c_value AS value, row_count, trunc(row_count * 100 / total_count, 2) AS row_percentage
Expand Down

0 comments on commit dcdd47c

Please sign in to comment.