From c612b724ed047fc2769f4a407595958d21964b1e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 9 Mar 2024 16:42:09 +0900 Subject: show only best scores in score chart --- services/app/assets/chart.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/app/assets/chart.js b/services/app/assets/chart.js index dab6cbf..5873080 100644 --- a/services/app/assets/chart.js +++ b/services/app/assets/chart.js @@ -31,6 +31,17 @@ document.addEventListener('DOMContentLoaded', async () => { } const stats = apiResult.stats; + // Filter best scores. + for (const s of stats) { + const bestScores = []; + for (const score of s.scores) { + if (bestScores.length === 0 || bestScores[bestScores.length - 1].code_size > score.code_size) { + bestScores.push(score); + } + } + s.scores = bestScores; + } + new Chart( chartCanvas, { -- cgit v1.2.3-70-g09d2