fix a little error in logic of createGroups() method
This commit is contained in:
parent
0434e141e7
commit
98be16708b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user