Browse Source

Batch detection #500 (#502)

pull/1/head
rozetko 6 years ago committed by Alexey Velikiy
parent
commit
6edd85ac93
  1. 7
      server/src/routes/analytic_units_router.ts

7
server/src/routes/analytic_units_router.ts

@ -4,6 +4,7 @@ import * as AnalyticUnit from '../models/analytic_unit_model';
import { createAnalyticUnitFromObject } from '../controllers/analytics_controller'; import { createAnalyticUnitFromObject } from '../controllers/analytics_controller';
import * as Router from 'koa-router'; import * as Router from 'koa-router';
import * as _ from 'lodash';
async function getStatus(ctx: Router.IRouterContext) { async function getStatus(ctx: Router.IRouterContext) {
@ -122,8 +123,10 @@ async function deleteUnit(ctx: Router.IRouterContext) {
} }
async function runDetect(ctx: Router.IRouterContext) { async function runDetect(ctx: Router.IRouterContext) {
const { id: analyticUnitId } = ctx.request.body as { id: AnalyticUnit.AnalyticUnitId }; const { ids } = ctx.request.body as { ids: AnalyticUnit.AnalyticUnitId[] };
AnalyticsController.runFirstLearning(analyticUnitId);
await Promise.all(ids.map(AnalyticsController.runFirstLearning));
ctx.response.body = { ctx.response.body = {
code: 200, code: 200,
message: 'Success' message: 'Success'

Loading…
Cancel
Save