diff --git a/src/routes/(app)/+page.server.ts b/src/routes/(app)/+page.server.ts index d2dee29..7d6af03 100644 --- a/src/routes/(app)/+page.server.ts +++ b/src/routes/(app)/+page.server.ts @@ -18,13 +18,13 @@ export const load: PageServerLoad = async ({ locals }) => { // ── LOGGED IN → dashboard data ── const recentMatches = await db.query.match.findMany({ - with: { participants: { with: { team: true } } }, + with: { participants: { with: { team: true } }, mappool: { with: { slots: true } } }, orderBy: desc(match.createdAt), limit: 5 }); const liveMatches = await db.query.match.findMany({ - with: { participants: { with: { team: true } } }, + with: { participants: { with: { team: true } }, mappool: { with: { slots: true } } }, where: inArray(match.state, ['LOBBY', 'ROLLING', 'PICKING', 'PLAYING']) }); diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index f2e3946..fda5981 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -76,6 +76,13 @@ return () => clearInterval(id); }); + function avgSR(mappool: any): string | null { + const slots = mappool?.slots; + if (!slots?.length) return null; + const avg = slots.reduce((s: number, sl: any) => s + (sl.starRating ?? 0), 0) / slots.length; + return avg.toFixed(2); + } + function timeAgo(date: string | Date) { const d = new Date(date); const diff = Date.now() - d.getTime(); @@ -335,6 +342,9 @@

{m.name ? `${m.name} · ` : ''}BO{config.bestOf} + {#if m.mappool} + · e.stopPropagation()} class='hover:text-accent hover:underline'>{m.mappool.name}{#if avgSR(m.mappool)} {avgSR(m.mappool)}★{/if} + {/if} · {timeAgo(m.finishedAt ?? m.createdAt)}

diff --git a/src/routes/(app)/mappools/+page.svelte b/src/routes/(app)/mappools/+page.svelte index 3d8a7b3..7d17652 100644 --- a/src/routes/(app)/mappools/+page.svelte +++ b/src/routes/(app)/mappools/+page.svelte @@ -63,7 +63,7 @@

{pool.name}

{pool.slots.length} map{pool.slots.length !== 1 ? 's' : ''} - {#if avgSr}· ★ {avgSr}{/if} + {#if avgSr}· {avgSr}★{/if} · Created {new Date(pool.createdAt).toLocaleDateString()}

diff --git a/src/routes/(app)/mappools/[id]/+page.svelte b/src/routes/(app)/mappools/[id]/+page.svelte index d557fe5..556e2ca 100644 --- a/src/routes/(app)/mappools/[id]/+page.svelte +++ b/src/routes/(app)/mappools/[id]/+page.svelte @@ -242,7 +242,7 @@
[{slot.beatmap.version}] - ★ {slot.beatmap.starRating.toFixed(2)} + {slot.beatmap.starRating.toFixed(2)}★ {slot.beatmap.bpm} BPM {formatLength(slot.beatmap.totalLength)}
diff --git a/src/routes/(app)/matches/+page.server.ts b/src/routes/(app)/matches/+page.server.ts index 5bd266a..28082a7 100644 --- a/src/routes/(app)/matches/+page.server.ts +++ b/src/routes/(app)/matches/+page.server.ts @@ -11,7 +11,7 @@ export const load: PageServerLoad = async ({ locals }) => { requireAuth(locals); const matches = await db.query.match.findMany({ - with: { participants: { with: { team: true } } }, + with: { participants: { with: { team: true } }, mappool: { with: { slots: true } } }, orderBy: desc(match.createdAt), limit: 50 }); diff --git a/src/routes/(app)/matches/+page.svelte b/src/routes/(app)/matches/+page.svelte index 4615668..d0d144f 100644 --- a/src/routes/(app)/matches/+page.svelte +++ b/src/routes/(app)/matches/+page.svelte @@ -39,6 +39,13 @@ return { p1, p2 }; } + function avgSR(mappool: any): string | null { + const slots = mappool?.slots; + if (!slots?.length) return null; + const avg = slots.reduce((s: number, sl: any) => s + (sl.starRating ?? 0), 0) / slots.length; + return avg.toFixed(2); + } + function timeAgo(date: string | Date) { const d = new Date(date); const diff = Date.now() - d.getTime(); @@ -281,6 +288,9 @@

{m.name ? `${m.name} · ` : ''}BO{config.bestOf} + {#if m.mappool} + · e.stopPropagation()} class='hover:text-accent hover:underline'>{m.mappool.name}{#if avgSR(m.mappool)} {avgSR(m.mappool)}★{/if} + {/if} {#if m.finishedAt} · {timeAgo(m.finishedAt)} {:else if m.createdAt} diff --git a/src/routes/(app)/matches/[id]/+page.svelte b/src/routes/(app)/matches/[id]/+page.svelte index b263b49..57f159d 100644 --- a/src/routes/(app)/matches/[id]/+page.svelte +++ b/src/routes/(app)/matches/[id]/+page.svelte @@ -304,7 +304,7 @@ {#if bm}

{bm.artist} - {bm.title} [{bm.version}]

-

★{bm.starRating.toFixed(1)} · {bm.bpm}bpm · {formatLength(bm.totalLength)}

+

{bm.starRating.toFixed(2)}★ · {bm.bpm}bpm · {formatLength(bm.totalLength)}

{/if} @@ -370,7 +370,7 @@ {/if} {#if mappoolAvgSR()} - avg ★{mappoolAvgSR()} + avg {mappoolAvgSR()}★ {/if} {#if pickingPhase} @@ -452,7 +452,7 @@
{#if bm}

{bm.artist} - {bm.title}

-

[{bm.version}] · ★{bm.starRating.toFixed(1)} · {bm.bpm}bpm

+

[{bm.version}] · {bm.starRating.toFixed(2)}★ · {bm.bpm}bpm

{:else}

#{slot.beatmapId}

{/if}