Skip to content

Commit

Permalink
Fix static value converter (#144034)
Browse files Browse the repository at this point in the history
  • Loading branch information
VladLasitsa authored Oct 27, 2022
1 parent 7839589 commit 8eeb9e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ describe('convertToStaticValueColumn', () => {
[{ series, metrics: [metric], dataView }, { visibleSeriesCount: 1 }],
null,
],
[
'null if value is not specified',
[{ series, metrics: [metric], dataView }, { visibleSeriesCount: 2 }],
null,
],
[
'static value column',
[{ series, metrics: [{ ...metric, value: 'some value' }], dataView }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export const convertToStaticValueColumn = (
return null;
}
const currentMetric = metrics[metrics.length - 1];
if (!currentMetric.value) {
return null;
}
return {
operationType: 'static_value',
references: [],
Expand Down Expand Up @@ -68,7 +71,10 @@ export const convertStaticValueToFormulaColumn = (
return null;
}
const currentMetric = metrics[metrics.length - 1];
return createFormulaColumn(currentMetric.value ?? '', {
if (!currentMetric.value) {
return null;
}
return createFormulaColumn(currentMetric.value, {
series,
metric: currentMetric,
dataView,
Expand Down

0 comments on commit 8eeb9e2

Please sign in to comment.