|
|
@ -156,7 +156,7 @@ async function getQueryRange( |
|
|
|
let segments: Segment.Segment[]; |
|
|
|
let segments: Segment.Segment[]; |
|
|
|
switch(detectorType) { |
|
|
|
switch(detectorType) { |
|
|
|
case AnalyticUnit.DetectorType.PATTERN: |
|
|
|
case AnalyticUnit.DetectorType.PATTERN: |
|
|
|
segments = await Segment.findMany(analyticUnitId, { $or: { labeled: true, deleted: true } }); |
|
|
|
segments = await Segment.findMany(analyticUnitId, { $or: [{ labeled: true }, { deleted: true }] }); |
|
|
|
if(segments.length === 0) { |
|
|
|
if(segments.length === 0) { |
|
|
|
throw new Error('Need at least 1 labeled segment'); |
|
|
|
throw new Error('Need at least 1 labeled segment'); |
|
|
|
} |
|
|
|
} |
|
|
@ -170,7 +170,7 @@ async function getQueryRange( |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
case AnalyticUnit.DetectorType.ANOMALY: |
|
|
|
case AnalyticUnit.DetectorType.ANOMALY: |
|
|
|
segments = await Segment.findMany(analyticUnitId, { $or: { labeled: true, deleted: true } }); |
|
|
|
segments = await Segment.findMany(analyticUnitId, { $or: [{ labeled: true }, { deleted: true }] }); |
|
|
|
if(segments.length === 0) { |
|
|
|
if(segments.length === 0) { |
|
|
|
const now = Date.now(); |
|
|
|
const now = Date.now(); |
|
|
|
return { |
|
|
|
return { |
|
|
|