fix threshold logic
This commit is contained in:
parent
8531c671f4
commit
03b7527839
1 changed files with 16 additions and 15 deletions
13
site.js
13
site.js
|
@ -260,15 +260,16 @@ async function siteCollector(user, path, site, useLimit, data2) {
|
||||||
for (let i = 0; i < d; i++) {
|
for (let i = 0; i < d; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
let tempSet = dat.map(x => x[0]);
|
let tempSet = dat.map(x => x[0]);
|
||||||
users = tempSet.concat(await rounder(tempSet, data, true));
|
let oldLength = Object.keys(data).length;
|
||||||
|
let theData = {};
|
||||||
|
for (let a = 0; a < oldLength * threshold && a < oldLength; a++) {
|
||||||
|
let key = Object.keys(data)[a];
|
||||||
|
theData[key] = data[key];
|
||||||
|
}
|
||||||
|
users = tempSet.concat(await rounder(tempSet, theData, true));
|
||||||
users = [...new Set(users)];
|
users = [...new Set(users)];
|
||||||
}
|
}
|
||||||
let oldLength = Object.keys(data).length;
|
|
||||||
for (let uf of users) {
|
for (let uf of users) {
|
||||||
if (Object.keys(data).length > oldLength * threshold) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let u = data[uf];
|
let u = data[uf];
|
||||||
if (!u) {
|
if (!u) {
|
||||||
data[uf] = { following: [], followers: [] }
|
data[uf] = { following: [], followers: [] }
|
||||||
|
|
Loading…
Reference in a new issue