Merge remote-tracking branch 'origin/api-v1.10.0' into dev
This commit is contained in:
commit
725a9917de
4 changed files with 10 additions and 8 deletions
|
|
@ -572,7 +572,7 @@ def get_funnel_sessions_by_issue(user_id, project_id, metric_id, issue_id,
|
|||
"issue": issue}
|
||||
|
||||
|
||||
def make_chart_from_card(project_id, user_id, metric_id, data: schemas.CardChartSchema, from_dashboard=False):
|
||||
def make_chart_from_card(project_id, user_id, metric_id, data: schemas.CardChartSchema, ignore_click_map=False):
|
||||
raw_metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, include_data=True)
|
||||
if raw_metric is None:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="card not found")
|
||||
|
|
@ -581,7 +581,7 @@ def make_chart_from_card(project_id, user_id, metric_id, data: schemas.CardChart
|
|||
return get_predefined_metric(key=metric.metric_of, project_id=project_id, data=data.dict())
|
||||
elif __is_click_map(metric):
|
||||
# TODO: remove this when UI is able to stop this endpoint calls for clickMap
|
||||
if from_dashboard:
|
||||
if ignore_click_map:
|
||||
return None
|
||||
if raw_metric["data"]:
|
||||
keys = sessions_mobs. \
|
||||
|
|
|
|||
|
|
@ -232,10 +232,11 @@ def get_card_chart(projectId: int, metric_id: int, request: Request, data: schem
|
|||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
# TODO: remove this when UI is able to stop this endpoint calls for clickMap
|
||||
import re
|
||||
from_dashboard = re.match(r".*\/[0-9]+\/dashboard\/[0-9]+$", request.headers.get('referer')) is not None \
|
||||
ignore_click_map = re.match(r".*\/[0-9]+\/dashboard\/[0-9]+$", request.headers.get('referer')) is not None \
|
||||
or re.match(r".*\/[0-9]+\/metrics$", request.headers.get('referer')) is not None \
|
||||
if request.headers.get('referer') else False
|
||||
data = custom_metrics.make_chart_from_card(project_id=projectId, user_id=context.user_id, metric_id=metric_id,
|
||||
data=data, from_dashboard=from_dashboard)
|
||||
data=data, ignore_click_map=ignore_click_map)
|
||||
return {"data": data}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -628,7 +628,7 @@ def get_funnel_sessions_by_issue(user_id, project_id, metric_id, issue_id,
|
|||
"issue": issue}
|
||||
|
||||
|
||||
def make_chart_from_card(project_id, user_id, metric_id, data: schemas.CardChartSchema, from_dashboard=False):
|
||||
def make_chart_from_card(project_id, user_id, metric_id, data: schemas.CardChartSchema, ignore_click_map=False):
|
||||
raw_metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, include_data=True)
|
||||
if raw_metric is None:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="card not found")
|
||||
|
|
@ -637,7 +637,7 @@ def make_chart_from_card(project_id, user_id, metric_id, data: schemas.CardChart
|
|||
return get_predefined_metric(key=metric.metric_of, project_id=project_id, data=data.dict())
|
||||
elif __is_click_map(metric):
|
||||
# TODO: remove this when UI is able to stop this endpoint calls for clickMap
|
||||
if from_dashboard:
|
||||
if ignore_click_map:
|
||||
return None
|
||||
if raw_metric["data"]:
|
||||
keys = sessions_mobs. \
|
||||
|
|
|
|||
|
|
@ -234,10 +234,11 @@ def get_card_chart(projectId: int, metric_id: int, request: Request, data: schem
|
|||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
# TODO: remove this when UI is able to stop this endpoint calls for clickMap
|
||||
import re
|
||||
from_dashboard = re.match(r".*\/[0-9]+\/dashboard\/[0-9]+$", request.headers.get('referer')) is not None \
|
||||
ignore_click_map = re.match(r".*\/[0-9]+\/dashboard\/[0-9]+$", request.headers.get('referer')) is not None \
|
||||
or re.match(r".*\/[0-9]+\/metrics$", request.headers.get('referer')) is not None \
|
||||
if request.headers.get('referer') else False
|
||||
data = custom_metrics.make_chart_from_card(project_id=projectId, user_id=context.user_id, metric_id=metric_id,
|
||||
data=data, from_dashboard=from_dashboard)
|
||||
data=data, ignore_click_map=ignore_click_map)
|
||||
return {"data": data}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue