From 8dba2e240e9540801b7ffb0bf37c2d8773ef7db4 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 2 Sep 2023 11:47:07 +0700 Subject: [PATCH] handle empty download hist stat --- tubearchivist/static/stats.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tubearchivist/static/stats.js b/tubearchivist/static/stats.js index 8a2616c..03e89b5 100644 --- a/tubearchivist/static/stats.js +++ b/tubearchivist/static/stats.js @@ -100,6 +100,12 @@ function downloadHist() { let apiEndpoint = '/api/stats/downloadhist/'; let responseData = apiRequest(apiEndpoint, 'GET'); let histBox = document.getElementById('downHistBox'); + if (responseData.length === 0) { + let tile = buildTile('No recent downloads'); + histBox.appendChild(tile); + return; + } + for (let i = 0; i < responseData.length; i++) { const dailyStat = responseData[i]; let tile = buildDailyStat(dailyStat);