diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-03-09 16:42:09 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-03-09 16:42:09 +0900 |
| commit | c612b724ed047fc2769f4a407595958d21964b1e (patch) | |
| tree | f3dfb42e3c7abd338c063681092fab3b92e7e92c /services | |
| parent | 6ef7b6b2d4390984d5fbf07c297c87758a8547a8 (diff) | |
| download | phperkaigi-2024-albatross-c612b724ed047fc2769f4a407595958d21964b1e.tar.gz phperkaigi-2024-albatross-c612b724ed047fc2769f4a407595958d21964b1e.tar.zst phperkaigi-2024-albatross-c612b724ed047fc2769f4a407595958d21964b1e.zip | |
show only best scores in score chart
Diffstat (limited to 'services')
| -rw-r--r-- | services/app/assets/chart.js | 11 |
1 files changed, 11 insertions, 0 deletions
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, { |
