feat(chalice): fixed 4xx and 5xx data transformer
This commit is contained in:
parent
fc388498cb
commit
673c892115
2 changed files with 6 additions and 3 deletions
|
|
@ -572,6 +572,9 @@ def make_chart_from_card(project_id, user_id, metric_id, data: schemas.CardChart
|
|||
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")
|
||||
print("<<<<<<<<<<<<>")
|
||||
print(raw_metric)
|
||||
print("<<<<<<<<<<<<>")
|
||||
metric: schemas.CreateCardSchema = schemas.CreateCardSchema(**raw_metric)
|
||||
if metric.is_template:
|
||||
return get_predefined_metric(key=metric.metric_of, project_id=project_id, data=data.dict())
|
||||
|
|
|
|||
|
|
@ -1610,7 +1610,7 @@ def get_domains_errors(project_id, startTimestamp=TimeUTC.now(delta_days=-1),
|
|||
"status_code": 4, **__get_constraint_values(args)}
|
||||
cur.execute(cur.mogrify(pg_query, params))
|
||||
rows = cur.fetchall()
|
||||
rows = __nested_array_to_dict_array(rows)
|
||||
rows = __nested_array_to_dict_array(rows, key="host")
|
||||
neutral = __get_neutral(rows)
|
||||
rows = __merge_rows_with_neutral(rows, neutral)
|
||||
|
||||
|
|
@ -1618,7 +1618,7 @@ def get_domains_errors(project_id, startTimestamp=TimeUTC.now(delta_days=-1),
|
|||
params["status_code"] = 5
|
||||
cur.execute(cur.mogrify(pg_query, params))
|
||||
rows = cur.fetchall()
|
||||
rows = __nested_array_to_dict_array(rows)
|
||||
rows = __nested_array_to_dict_array(rows, key="host")
|
||||
neutral = __get_neutral(rows)
|
||||
rows = __merge_rows_with_neutral(rows, neutral)
|
||||
result["5xx"] = rows
|
||||
|
|
@ -1658,7 +1658,7 @@ def __get_domains_errors_4xx_and_5xx(status, project_id, startTimestamp=TimeUTC.
|
|||
"status_code": status, **__get_constraint_values(args)}
|
||||
cur.execute(cur.mogrify(pg_query, params))
|
||||
rows = cur.fetchall()
|
||||
rows = __nested_array_to_dict_array(rows)
|
||||
rows = __nested_array_to_dict_array(rows, key="host")
|
||||
neutral = __get_neutral(rows)
|
||||
rows = __merge_rows_with_neutral(rows, neutral)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue