Skip to content

Commit

Permalink
Sort yearly stats from newest to oldest
Browse files Browse the repository at this point in the history
Fixes #144.
  • Loading branch information
dbrgn committed Mar 14, 2024
1 parent 9764fa4 commit e6a3c94
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/src/routes/stats/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import type {Data} from './+page';
export let data: Data;
$: sortedStats = Object.entries(data.yearlyStats)
.map(([year, stats]) => ({year, ...stats}))
.sort((a, b) => b.year.localeCompare(a.year));
</script>

<nav class="breadcrumb" aria-label="breadcrumbs">
Expand Down Expand Up @@ -35,11 +39,9 @@
</tr>
</thead>
<tbody>
{#each Object.entries(data.yearlyStats) as entry}
{@const year = entry[0]}
{@const stats = entry[1]}
{#each sortedStats as stats}
<tr>
<td>{year}</td>
<td>{stats.year}</td>
<td>{stats.flightCount}</td>
<td>{stats.hikeandflyCount}</td>
<td>
Expand Down

0 comments on commit e6a3c94

Please sign in to comment.