Update endpoints/antibot.js
Browse files- endpoints/antibot.js +2 -33
endpoints/antibot.js
CHANGED
|
@@ -265,7 +265,6 @@ async function antibot(data) {
|
|
| 265 |
console.log('π DEBUG: Starting matching process...');
|
| 266 |
const result = [];
|
| 267 |
const usedIds = new Set();
|
| 268 |
-
let matchedCount = 0;
|
| 269 |
|
| 270 |
for (let i = 0; i < soalArray.length; i++) {
|
| 271 |
const targetSoal = soalArray[i];
|
|
@@ -277,47 +276,18 @@ async function antibot(data) {
|
|
| 277 |
isValueMatch(bot.value, targetSoal)) {
|
| 278 |
foundId = bot.id;
|
| 279 |
usedIds.add(bot.id);
|
| 280 |
-
matchedCount++;
|
| 281 |
console.log(`β
DEBUG: Soal "${targetSoal}" matched with bot ${bot.id}`);
|
| 282 |
break;
|
| 283 |
}
|
| 284 |
}
|
| 285 |
|
| 286 |
result.push({
|
| 287 |
-
id: foundId,
|
| 288 |
soal: targetSoal,
|
| 289 |
-
matchType: foundId ? 'exact' : '
|
| 290 |
});
|
| 291 |
}
|
| 292 |
|
| 293 |
-
console.log(`π DEBUG: Initial matches: ${matchedCount}/${soalArray.length}`);
|
| 294 |
-
|
| 295 |
-
const unmatchedBots = botResults.filter(bot => !usedIds.has(bot.id) && bot.value && bot.value.trim() !== '');
|
| 296 |
-
console.log(`β DEBUG: Unmatched bots with answers: ${unmatchedBots.length}`);
|
| 297 |
-
|
| 298 |
-
for (const bot of unmatchedBots) {
|
| 299 |
-
result.push({
|
| 300 |
-
id: bot.id,
|
| 301 |
-
soal: '',
|
| 302 |
-
matchType: 'unmatched'
|
| 303 |
-
});
|
| 304 |
-
usedIds.add(bot.id);
|
| 305 |
-
console.log(`β DEBUG: Added unmatched bot ${bot.id} to result`);
|
| 306 |
-
}
|
| 307 |
-
|
| 308 |
-
const noAnswerBots = botResults.filter(bot => !usedIds.has(bot.id));
|
| 309 |
-
console.log(`β DEBUG: No answer bots: ${noAnswerBots.length}`);
|
| 310 |
-
|
| 311 |
-
for (const bot of noAnswerBots) {
|
| 312 |
-
result.push({
|
| 313 |
-
id: bot.id,
|
| 314 |
-
soal: '',
|
| 315 |
-
matchType: 'invalid'
|
| 316 |
-
});
|
| 317 |
-
usedIds.add(bot.id);
|
| 318 |
-
console.log(`β DEBUG: Added no-answer bot ${bot.id} to result`);
|
| 319 |
-
}
|
| 320 |
-
|
| 321 |
console.log('π DEBUG: Process completed successfully');
|
| 322 |
console.log('π DEBUG Final Result:', result);
|
| 323 |
|
|
@@ -335,7 +305,6 @@ async function antibot(data) {
|
|
| 335 |
matchType: r.matchType,
|
| 336 |
soal: r.soal
|
| 337 |
})),
|
| 338 |
-
totalMatches: matchedCount,
|
| 339 |
totalResults: result.length
|
| 340 |
}
|
| 341 |
}
|
|
|
|
| 265 |
console.log('π DEBUG: Starting matching process...');
|
| 266 |
const result = [];
|
| 267 |
const usedIds = new Set();
|
|
|
|
| 268 |
|
| 269 |
for (let i = 0; i < soalArray.length; i++) {
|
| 270 |
const targetSoal = soalArray[i];
|
|
|
|
| 276 |
isValueMatch(bot.value, targetSoal)) {
|
| 277 |
foundId = bot.id;
|
| 278 |
usedIds.add(bot.id);
|
|
|
|
| 279 |
console.log(`β
DEBUG: Soal "${targetSoal}" matched with bot ${bot.id}`);
|
| 280 |
break;
|
| 281 |
}
|
| 282 |
}
|
| 283 |
|
| 284 |
result.push({
|
| 285 |
+
id: foundId || 'invalid',
|
| 286 |
soal: targetSoal,
|
| 287 |
+
matchType: foundId ? 'exact' : 'invalid'
|
| 288 |
});
|
| 289 |
}
|
| 290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
console.log('π DEBUG: Process completed successfully');
|
| 292 |
console.log('π DEBUG Final Result:', result);
|
| 293 |
|
|
|
|
| 305 |
matchType: r.matchType,
|
| 306 |
soal: r.soal
|
| 307 |
})),
|
|
|
|
| 308 |
totalResults: result.length
|
| 309 |
}
|
| 310 |
}
|