From f73d87361ac4a0a60a30d8dfeee08b294d68cf58 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Thu, 22 Oct 2020 10:29:45 +0300 Subject: [PATCH] Refactor result comparison Signed-off-by: Lauri Nevala --- src/main/cluster-detectors/detector-registry.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/cluster-detectors/detector-registry.ts b/src/main/cluster-detectors/detector-registry.ts index d812570bce..577fdf2d85 100644 --- a/src/main/cluster-detectors/detector-registry.ts +++ b/src/main/cluster-detectors/detector-registry.ts @@ -23,9 +23,8 @@ export class DetectorRegistry { const data = await detector.detect() if (!data) continue; const existingValue = results[detector.key] - if ((existingValue && existingValue.accuracy < data.accuracy) || !existingValue) { // previous value exists and is less accurate - results[detector.key] = data - } + if (existingValue && existingValue.accuracy > data.accuracy) continue; // previous value exists and is more accurate + results[detector.key] = data } catch (e) { // detector raised error, do nothing }