From: David MAECHLER Date: Sat, 4 Apr 2020 19:06:34 +0000 (+0200) Subject: fix a little error in logic of createGroups() method X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=98be16708b14f6b7caa9ce89c89fe6f6500d436d;p=libreadventure.git fix a little error in logic of createGroups() method --- 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; }