Browse Source

Clear detection spans on learning #601

pull/1/head
rozetko 6 years ago
parent
commit
3860b8f95c
  1. 1
      server/src/controllers/analytics_controller.ts
  2. 4
      server/src/models/detection_model.ts

1
server/src/controllers/analytics_controller.ts

@ -458,6 +458,7 @@ export async function updateThreshold(
export async function runLearningWithDetection(id: AnalyticUnit.AnalyticUnitId) { export async function runLearningWithDetection(id: AnalyticUnit.AnalyticUnitId) {
// TODO: move setting status somehow "inside" learning // TODO: move setting status somehow "inside" learning
await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.PENDING); await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.PENDING);
await Detection.clearSpans(id);
runLearning(id) runLearning(id)
.then(() => runDetect(id)) .then(() => runDetect(id))
.catch(err => console.error(err)); .catch(err => console.error(err));

4
server/src/models/detection_model.ts

@ -138,3 +138,7 @@ export function getSpanBorders(spans: DetectionSpan[]): number[] {
return spanBorders; return spanBorders;
} }
export function clearSpans(analyticUnitId: AnalyticUnitId) {
return db.removeMany({ analyticUnitId });
}

Loading…
Cancel
Save