fix: sorting by saved metric (#13059)

This commit is contained in:
Ville Brofeldt 2021-02-10 21:45:45 +02:00 committed by GitHub
parent 4183a03542
commit c1e10c4627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1150,6 +1150,8 @@ class SqlaTable( # pylint: disable=too-many-public-methods,too-many-instance-at
col = self.adhoc_metric_to_sqla(col, columns_by_name)
elif col in columns_by_name:
col = columns_by_name[col].get_sqla_col()
elif col in metrics_by_name:
col = metrics_by_name[col].get_sqla_col()
if isinstance(col, Label):
label = col._label # pylint: disable=protected-access

View File

@ -271,8 +271,8 @@ def create_slices(
groupby=["name"],
adhoc_filters=[gen_filter("gender", "girl")],
row_limit=50,
timeseries_limit_metric="sum__num",
metrics=metrics,
timeseries_limit_metric=metric,
metrics=[metric],
),
),
Slice(
@ -300,7 +300,8 @@ def create_slices(
groupby=["name"],
adhoc_filters=[gen_filter("gender", "boy")],
row_limit=50,
metrics=metrics,
timeseries_limit_metric=metric,
metrics=[metric],
),
),
Slice(