From 789fafd0f6ff7e7f25d74378fb3f54e6c34414be Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sat, 9 Apr 2022 23:21:24 -0400 Subject: [PATCH] tweak: cosmetic improvments to good judgment fetcher --- src/backend/platforms/goodjudgmentopen.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/platforms/goodjudgmentopen.ts b/src/backend/platforms/goodjudgmentopen.ts index 7b970f8..a4e73f0 100644 --- a/src/backend/platforms/goodjudgmentopen.ts +++ b/src/backend/platforms/goodjudgmentopen.ts @@ -139,17 +139,17 @@ function isSignedIn(html) { if (!isSignedInBool) { console.log("Error: Not signed in."); } - console.log(`is signed in? ${isSignedInBool}`); + console.log(`is signed in? ${isSignedInBool ? "yes" : "no"}`); return isSignedInBool; } -function isEnd(html) { - let isEndBool = html.includes("No questions match your filter"); - if (isEndBool) { +function reachedEnd(html) { + let reachedEndBool = html.includes("No questions match your filter"); + if (reachedEndBool) { //console.log(html) } - console.log(`IsEnd? ${isEndBool}`); - return isEndBool; + console.log(`Reached end? ${reachedEndBool}`); + return reachedEndBool; } function sleep(ms: number) { @@ -165,7 +165,7 @@ async function goodjudgmentopen_inner(cookie) { let results = []; let init = Date.now(); // console.log("Downloading... This might take a couple of minutes. Results will be shown.") - while (!isEnd(response) && isSignedIn(response)) { + while (!reachedEnd(response) && isSignedIn(response)) { let htmlLines = response.split("\n"); DEBUG_MODE == "on" ? htmlLines.forEach((line) => console.log(line)) : id(); let h5elements = htmlLines.filter((str) => str.includes("