Skip to content

Commit

Permalink
refactor(chalice): path-analysis card, return issues identical to the…
Browse files Browse the repository at this point in the history
… chart
  • Loading branch information
tahayk committed Jul 3, 2024
1 parent 13535e3 commit bebb0ef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions api/chalicelib/core/custom_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,20 @@ def __get_path_analysis_issues(project_id: int, user_id: int, data: schemas.Card
page=data.page,
filters=filters
)
# ---- To make issues response close to the chart response
search_data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.events_count,
operator=schemas.MathOperator._greater,
value=[1]))
if len(data.start_point) == 0:
search_data.events.append(schemas.SessionSearchEventSchema2(type=schemas.EventType.location,
operator=schemas.SearchEventOperator._is_any,
value=[]))
# ---- End

for s in data.excludes:
search_data.filters.append(schemas.SessionSearchEventSchema2(type=s.type,
operator=schemas.SearchEventOperator._not_on,
value=s.value))
search_data.events.append(schemas.SessionSearchEventSchema2(type=s.type,
operator=schemas.SearchEventOperator._not_on,
value=s.value))
result = sessions.search_table_of_individual_issues(project_id=project_id, data=search_data)
return result

Expand Down
15 changes: 12 additions & 3 deletions ee/api/chalicelib/core/custom_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,20 @@ def __get_path_analysis_issues(project_id: int, user_id: int, data: schemas.Card
page=data.page,
filters=filters
)
# ---- To make issues response close to the chart response
search_data.filters.append(schemas.SessionSearchFilterSchema(type=schemas.FilterType.events_count,
operator=schemas.MathOperator._greater,
value=[1]))
if len(data.start_point) == 0:
search_data.events.append(schemas.SessionSearchEventSchema2(type=schemas.EventType.location,
operator=schemas.SearchEventOperator._is_any,
value=[]))
# ---- End

for s in data.excludes:
search_data.filters.append(schemas.SessionSearchEventSchema2(type=s.type,
operator=schemas.SearchEventOperator._not_on,
value=s.value))
search_data.events.append(schemas.SessionSearchEventSchema2(type=s.type,
operator=schemas.SearchEventOperator._not_on,
value=s.value))
result = sessions.search_table_of_individual_issues(project_id=project_id, data=search_data)
return result

Expand Down

0 comments on commit bebb0ef

Please sign in to comment.