Dev (#2331)
* refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * feat(chalice): support table-of-browsers showing user-count * feat(chalice): support table-of-devices showing user-count * feat(chalice): support table-of-URLs showing user-count * refactor(DB): update webVital UI configuration * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps
This commit is contained in:
parent
1434e937ab
commit
11c4d9e114
7 changed files with 76 additions and 4 deletions
|
|
@ -147,14 +147,29 @@ def search_short_session(data: schemas.ClickMapSessionsSearch, project_id, user_
|
||||||
include_mobs: bool = True, exclude_sessions: list[str] = [],
|
include_mobs: bool = True, exclude_sessions: list[str] = [],
|
||||||
_depth: int = 3):
|
_depth: int = 3):
|
||||||
no_platform = True
|
no_platform = True
|
||||||
|
no_location = True
|
||||||
for f in data.filters:
|
for f in data.filters:
|
||||||
if f.type == schemas.FilterType.platform:
|
if f.type == schemas.FilterType.platform:
|
||||||
no_platform = False
|
no_platform = False
|
||||||
break
|
break
|
||||||
|
for f in data.events:
|
||||||
|
if f.type == schemas.EventType.location:
|
||||||
|
no_location = False
|
||||||
|
if len(f.value) == 0:
|
||||||
|
f.operator = schemas.SearchEventOperator._is_any
|
||||||
|
break
|
||||||
if no_platform:
|
if no_platform:
|
||||||
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.platform,
|
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.platform,
|
||||||
value=[schemas.PlatformType.desktop],
|
value=[schemas.PlatformType.desktop],
|
||||||
operator=schemas.SearchEventOperator._is))
|
operator=schemas.SearchEventOperator._is))
|
||||||
|
if no_location:
|
||||||
|
data.events.append(schemas.SessionSearchEventSchema2(type=schemas.EventType.location,
|
||||||
|
value=[],
|
||||||
|
operator=schemas.SearchEventOperator._is_any))
|
||||||
|
|
||||||
|
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.events_count,
|
||||||
|
value=[0],
|
||||||
|
operator=schemas.MathOperator._greater))
|
||||||
|
|
||||||
full_args, query_part = sessions.search_query_parts(data=data, error_status=None, errors_only=False,
|
full_args, query_part = sessions.search_query_parts(data=data, error_status=None, errors_only=False,
|
||||||
favorite_only=data.bookmarked, issue=None,
|
favorite_only=data.bookmarked, issue=None,
|
||||||
|
|
@ -199,6 +214,8 @@ def search_short_session(data: schemas.ClickMapSessionsSearch, project_id, user_
|
||||||
logger.info("couldn't find an existing replay after 3 iterations for heatmap")
|
logger.info("couldn't find an existing replay after 3 iterations for heatmap")
|
||||||
|
|
||||||
session['events'] = get_page_events(session_id=session["session_id"])
|
session['events'] = get_page_events(session_id=session["session_id"])
|
||||||
|
else:
|
||||||
|
logger.debug("No session found for heatmap")
|
||||||
|
|
||||||
return helper.dict_to_camel_case(session)
|
return helper.dict_to_camel_case(session)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status,
|
||||||
f_k = f"f_value{i}"
|
f_k = f"f_value{i}"
|
||||||
full_args = {**full_args, **sh.multi_values(f.value, value_key=f_k)}
|
full_args = {**full_args, **sh.multi_values(f.value, value_key=f_k)}
|
||||||
op = sh.get_sql_operator(f.operator) \
|
op = sh.get_sql_operator(f.operator) \
|
||||||
if filter_type not in [schemas.FilterType.events_count] else f.operator
|
if filter_type not in [schemas.FilterType.events_count] else f.operator.value
|
||||||
is_any = sh.isAny_opreator(f.operator)
|
is_any = sh.isAny_opreator(f.operator)
|
||||||
is_undefined = sh.isUndefined_operator(f.operator)
|
is_undefined = sh.isUndefined_operator(f.operator)
|
||||||
if not is_any and not is_undefined and len(f.value) == 0:
|
if not is_any and not is_undefined and len(f.value) == 0:
|
||||||
|
|
|
||||||
|
|
@ -700,7 +700,7 @@ class SessionSearchFilterSchema(BaseModel):
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"value should be of type PlatformType for {values.type} filter")
|
raise ValueError(f"value should be of type PlatformType for {values.type} filter")
|
||||||
elif values.type == FilterType.events_count:
|
elif values.type == FilterType.events_count:
|
||||||
if values.operator in MathOperator.has_value(values.operator):
|
if MathOperator.has_value(values.operator):
|
||||||
values.operator = MathOperator(values.operator)
|
values.operator = MathOperator(values.operator)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"operator should be of type MathOperator for {values.type} filter")
|
raise ValueError(f"operator should be of type MathOperator for {values.type} filter")
|
||||||
|
|
|
||||||
|
|
@ -163,14 +163,29 @@ if not config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||||
include_mobs: bool = True, exclude_sessions: list[str] = [],
|
include_mobs: bool = True, exclude_sessions: list[str] = [],
|
||||||
_depth: int = 3):
|
_depth: int = 3):
|
||||||
no_platform = True
|
no_platform = True
|
||||||
|
no_location = True
|
||||||
for f in data.filters:
|
for f in data.filters:
|
||||||
if f.type == schemas.FilterType.platform:
|
if f.type == schemas.FilterType.platform:
|
||||||
no_platform = False
|
no_platform = False
|
||||||
break
|
break
|
||||||
|
for f in data.events:
|
||||||
|
if f.type == schemas.EventType.location:
|
||||||
|
no_location = False
|
||||||
|
if len(f.value) == 0:
|
||||||
|
f.operator = schemas.SearchEventOperator._is_any
|
||||||
|
break
|
||||||
if no_platform:
|
if no_platform:
|
||||||
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.platform,
|
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.platform,
|
||||||
value=[schemas.PlatformType.desktop],
|
value=[schemas.PlatformType.desktop],
|
||||||
operator=schemas.SearchEventOperator._is))
|
operator=schemas.SearchEventOperator._is))
|
||||||
|
if no_location:
|
||||||
|
data.events.append(schemas.SessionSearchEventSchema2(type=schemas.EventType.location,
|
||||||
|
value=[],
|
||||||
|
operator=schemas.SearchEventOperator._is_any))
|
||||||
|
|
||||||
|
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.events_count,
|
||||||
|
value=[0],
|
||||||
|
operator=schemas.MathOperator._greater))
|
||||||
|
|
||||||
full_args, query_part = sessions.search_query_parts(data=data, error_status=None, errors_only=False,
|
full_args, query_part = sessions.search_query_parts(data=data, error_status=None, errors_only=False,
|
||||||
favorite_only=data.bookmarked, issue=None,
|
favorite_only=data.bookmarked, issue=None,
|
||||||
|
|
@ -214,7 +229,9 @@ if not config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||||
elif _depth == 0 and len(session['domURL']) == 0 and len(session['mobsUrl']) == 0:
|
elif _depth == 0 and len(session['domURL']) == 0 and len(session['mobsUrl']) == 0:
|
||||||
logger.info("couldn't find an existing replay after 3 iterations for heatmap")
|
logger.info("couldn't find an existing replay after 3 iterations for heatmap")
|
||||||
|
|
||||||
session['events'] = get_page_events(session_id=session["session_id"])
|
session['events'] = get_page_events(session_id=session["session_id"])
|
||||||
|
else:
|
||||||
|
logger.debug("No session found for heatmap")
|
||||||
|
|
||||||
return helper.dict_to_camel_case(session)
|
return helper.dict_to_camel_case(session)
|
||||||
|
|
||||||
|
|
@ -277,14 +294,29 @@ else:
|
||||||
include_mobs: bool = True, exclude_sessions: list[str] = [],
|
include_mobs: bool = True, exclude_sessions: list[str] = [],
|
||||||
_depth: int = 3):
|
_depth: int = 3):
|
||||||
no_platform = True
|
no_platform = True
|
||||||
|
no_location = True
|
||||||
for f in data.filters:
|
for f in data.filters:
|
||||||
if f.type == schemas.FilterType.platform:
|
if f.type == schemas.FilterType.platform:
|
||||||
no_platform = False
|
no_platform = False
|
||||||
break
|
break
|
||||||
|
for f in data.events:
|
||||||
|
if f.type == schemas.EventType.location:
|
||||||
|
no_location = False
|
||||||
|
if len(f.value) == 0:
|
||||||
|
f.operator = schemas.SearchEventOperator._is_any
|
||||||
|
break
|
||||||
if no_platform:
|
if no_platform:
|
||||||
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.platform,
|
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.platform,
|
||||||
value=[schemas.PlatformType.desktop],
|
value=[schemas.PlatformType.desktop],
|
||||||
operator=schemas.SearchEventOperator._is))
|
operator=schemas.SearchEventOperator._is))
|
||||||
|
if no_location:
|
||||||
|
data.events.append(schemas.SessionSearchEventSchema2(type=schemas.EventType.location,
|
||||||
|
value=[],
|
||||||
|
operator=schemas.SearchEventOperator._is_any))
|
||||||
|
|
||||||
|
data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.events_count,
|
||||||
|
value=[0],
|
||||||
|
operator=schemas.MathOperator._greater))
|
||||||
|
|
||||||
full_args, query_part = sessions.search_query_parts_ch(data=data, error_status=None, errors_only=False,
|
full_args, query_part = sessions.search_query_parts_ch(data=data, error_status=None, errors_only=False,
|
||||||
favorite_only=data.bookmarked, issue=None,
|
favorite_only=data.bookmarked, issue=None,
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,7 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu
|
||||||
f_k = f"f_value{i}"
|
f_k = f"f_value{i}"
|
||||||
full_args = {**full_args, f_k: f.value, **_multiple_values(f.value, value_key=f_k)}
|
full_args = {**full_args, f_k: f.value, **_multiple_values(f.value, value_key=f_k)}
|
||||||
op = __get_sql_operator(f.operator) \
|
op = __get_sql_operator(f.operator) \
|
||||||
if filter_type not in [schemas.FilterType.events_count] else f.operator
|
if filter_type not in [schemas.FilterType.events_count] else f.operator.value
|
||||||
is_any = _isAny_opreator(f.operator)
|
is_any = _isAny_opreator(f.operator)
|
||||||
is_undefined = _isUndefined_operator(f.operator)
|
is_undefined = _isUndefined_operator(f.operator)
|
||||||
if not is_any and not is_undefined and len(f.value) == 0:
|
if not is_any and not is_undefined and len(f.value) == 0:
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,18 @@ ALTER TABLE IF EXISTS events.clicks
|
||||||
ADD COLUMN IF NOT EXISTS normalized_x smallint NULL,
|
ADD COLUMN IF NOT EXISTS normalized_x smallint NULL,
|
||||||
ADD COLUMN IF NOT EXISTS normalized_y smallint NULL;
|
ADD COLUMN IF NOT EXISTS normalized_y smallint NULL;
|
||||||
|
|
||||||
|
UPDATE public.metrics
|
||||||
|
SET default_config=default_config || '{"col":2}'
|
||||||
|
WHERE metric_type = 'webVitals'
|
||||||
|
AND default_config ->> 'col' = '1';
|
||||||
|
|
||||||
|
UPDATE public.dashboard_widgets
|
||||||
|
SET config=config || '{"col":2}'
|
||||||
|
WHERE metric_id IN (SELECT metric_id
|
||||||
|
FROM public.metrics
|
||||||
|
WHERE metric_type = 'webVitals')
|
||||||
|
AND config ->> 'col' = '1';
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
\elif :is_next
|
\elif :is_next
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,17 @@ ALTER TABLE IF EXISTS events.clicks
|
||||||
ADD COLUMN IF NOT EXISTS normalized_x smallint NULL,
|
ADD COLUMN IF NOT EXISTS normalized_x smallint NULL,
|
||||||
ADD COLUMN IF NOT EXISTS normalized_y smallint NULL;
|
ADD COLUMN IF NOT EXISTS normalized_y smallint NULL;
|
||||||
|
|
||||||
|
UPDATE public.metrics
|
||||||
|
SET default_config=default_config || '{"col":2}'
|
||||||
|
WHERE metric_type = 'webVitals'
|
||||||
|
AND default_config ->> 'col' = '1';
|
||||||
|
|
||||||
|
UPDATE public.dashboard_widgets
|
||||||
|
SET config=config || '{"col":2}'
|
||||||
|
WHERE metric_id IN (SELECT metric_id
|
||||||
|
FROM public.metrics
|
||||||
|
WHERE metric_type = 'webVitals')
|
||||||
|
AND config ->> 'col' = '1';
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue