From 7474742a959c56938039086cac83da3ec05c6d3c Mon Sep 17 00:00:00 2001 From: Kendell R Date: Mon, 1 Jan 2024 08:09:31 -0800 Subject: [PATCH] switch to total counting --- docs/index.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/index.html b/docs/index.html index 0570e88..c1c9fa4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -53,7 +53,7 @@

Skyclient

/>

Safe. Rated 4.54/5 on Discord.

-

Latest versions downloaded ... times.

+

Skyclient has been downloaded ... times.

), fetch("https://api.github.com/repos/KTibow/Mart/releases").then((r) => r.json()), ]).then(async (responses) => { - const getCount = (json) => { - const artifact = json[0].assets[0]; - if (!artifact) return 0; - return artifact.download_count; - }; - const count = getCount(responses[0]) + getCount(responses[1]) + getCount(responses[2]); - document.getElementById("template-versions").innerText = count; + let count = 0; + for (const repo of responses) { + for (const release of repo) { + const artifact = release.assets[0]; + if (!artifact) continue; + count += artifact.download_count; + } + } + document.getElementById("template-versions").innerText = count.toLocaleString(); });