Browse Source

Adjust to new queryByMetric return type (#163)

pull/1/head
rozetko 6 years ago committed by Alexey Velikiy
parent
commit
7ffb712561
  1. 6
      server/src/controllers/analytics_controller.ts

6
server/src/controllers/analytics_controller.ts

@ -107,7 +107,8 @@ export async function runLearning(id: AnalyticUnit.AnalyticUnitId) {
let segmentObjs = segments.map(s => s.toObject());
let { from, to } = getQueryRangeForLearningBySegments(segments);
let data = await queryByMetric(analyticUnit.metric, analyticUnit.panelUrl, from, to, HASTIC_API_KEY);
let queryResult = await queryByMetric(analyticUnit.metric, analyticUnit.panelUrl, from, to, HASTIC_API_KEY);
let data = queryResult.values;
if(data.length === 0) {
throw new Error('Empty data to learn on');
}
@ -149,7 +150,8 @@ export async function runPredict(id: AnalyticUnit.AnalyticUnitId) {
}
let { from, to } = getQueryRangeForLearningBySegments(segments);
let data = await queryByMetric(unit.metric, unit.panelUrl, from, to, HASTIC_API_KEY);
let queryResult = await queryByMetric(unit.metric, unit.panelUrl, from, to, HASTIC_API_KEY);
let data = queryResult.values;
if(data.length === 0) {
throw new Error('Empty data to predict on');
}

Loading…
Cancel
Save