From 98be16708b14f6b7caa9ce89c89fe6f6500d436d Mon Sep 17 00:00:00 2001 From: David MAECHLER Date: Sat, 4 Apr 2020 21:06:34 +0200 Subject: [PATCH] fix a little error in logic of createGroups() method --- back/src/Controller/position.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/back/src/Controller/position.js b/back/src/Controller/position.js index 8c445b1..d8f6aff 100644 --- a/back/src/Controller/position.js +++ b/back/src/Controller/position.js @@ -55,7 +55,7 @@ let createGroups = function(distances) { groups[i] = []; } - if(groups[i].indexOf(dist.first) && typeof alreadyInGroup[dist.first.id] === 'undefined') { + if(!groups[i].indexOf(dist.first) && typeof alreadyInGroup[dist.first.id] === 'undefined') { groups[i].push(dist.first); alreadyInGroup [dist.first.id] = true; } @@ -69,7 +69,7 @@ let createGroups = function(distances) { continue; } - if(groups[i].indexOf(dist.second) && typeof alreadyInGroup[dist.second.id] === 'undefined') { + if(!groups[i].indexOf(dist.second) && typeof alreadyInGroup[dist.second.id] === 'undefined') { groups[i].push(dist.second); alreadyInGroup [dist.second.id] = true; } -- 2.25.1