Skip to content

Commit

Permalink
fix(dashboard): type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GerilLeto committed Dec 2, 2024
1 parent 142d48a commit d8df70a
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import _ from 'lodash';
import {
CombinedMetricCol,
DerivedMetric,
DimensionColDataType,
DimensionInfo,
MetricDetail,
MetricSourceCol,
} from './metric-detail.types';

const isDerivedMetric = (data: MetricDetail) => 'cols' in data;

export function parseData(data: MetricDetail) {
if (isDerivedMetric(data)) {
if ('cols' in data) {
const { cols } = data as DerivedMetric;
return {
filters: data.cols.filter((c) => c.type === 'filter').map((c) => c.metricSourceCol),
groupBys: data.cols.filter((c) => c.type === 'group_by').map((c) => c.metricSourceCol),
trendingDateCol: data.cols.find((c) => c.type === 'trending_date_col')?.metricSourceCol ?? null,
filters: cols.filter((c) => c.type === 'filter').map((c) => c.metricSourceCol),
groupBys: cols.filter((c) => c.type === 'group_by').map((c) => c.metricSourceCol),
trendingDateCol: cols.find((c) => c.type === 'trending_date_col')?.metricSourceCol ?? null,
};
}

Expand Down

0 comments on commit d8df70a

Please sign in to comment.