From 229d0ce308dc47795d7323af9b0a128a0ef7f4ec Mon Sep 17 00:00:00 2001 From: payne911 Date: Tue, 21 Mar 2023 23:56:51 -0400 Subject: [PATCH] Avoid querying a duplicated result (resolve #59) --- website/src/queries-logic.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/website/src/queries-logic.js b/website/src/queries-logic.js index e227ce5e..8ea5a51d 100644 --- a/website/src/queries-logic.js +++ b/website/src/queries-logic.js @@ -194,6 +194,14 @@ function update_table_trying_use_filter() { } } +function is_duplicate_repo(name) { + for (const fork of TABLE_DATA) { + if (fork['name'] === name) + return true; + } + return false; +} + /** Updates table data, then calls function to update the table. */ function update_table_data(responseData, user, repo, parentDefaultBranch) { if (isEmpty(responseData)) { @@ -209,6 +217,9 @@ function update_table_data(responseData, user, repo, parentDefaultBranch) { if (RATE_LIMIT_EXCEEDED) // we can skip everything below because they are only requests continue; + if (is_duplicate_repo(currFork.full_name)) + continue; // abort because repo is already listed + let datum = { 'name': currFork.full_name, 'stars': currFork.stargazers_count,